from rq_interfaces.msg import Projection
from rq_interfaces.srv import AquireProjection

import rclpy
from rclpy.node import Node


class BaseHardwareInterfaceService(Node):
    def __init__(self, node_name: str = 'rq_base_hardware_interface_service'):
        super().__init__(node_name)
        self.srv = self.create_service(AquireProjection, 'aquire_projection', self.aquire_projection_callback)
        self.topic = self.create_publisher(Projection, 'current_projection', 1)
        self.aquired_projections = 0

    def aquire_projection_callback(self,
                                   rquest: AquireProjection.Request,
                                   response: AquireProjection.Response) -> rclpy.Future:
        raise NotImplementedError
    
    def publish_projection(self, projection: Projection):
        self.topic.publish(projection)
        self.aquired_projections += 1
        self.get_logger().info(f'Published projection number: {self.aquired_projections}')