from lib.services.redis.nodegroup_client import NodeGroupClientInterface
from lib.api_schema.response.flava_services.redis.v1_0 import (
    nodegroup as schema,
)


class FlavaNodeGroupClient(NodeGroupClientInterface):
    """Service client for the Flava NodeGroup API.

    This client provides the schema and path to each API endpoint for dependency
    injection.
    """

    def get_schema(self):
        """Provide the response schema of the NodeGroup API."""
        return schema

    def get_node_groups_path(self, project_name, service_name):
        """Provide the API endpoint path for node groups."""
        return f"/projects/{project_name}/services/{service_name}/nodeGroups"

    def get_scale_nodes_path(self, project_name, service_name):
        """Provide the API endpoint path for scaling nodes."""
        return f"/projects/{project_name}/services/{service_name}/nodeGroups/scaleNodes"

    def get_server_type_path(self, project_name, service_name):
        """Provide the API endpoint path for updating server type."""
        return f"/projects/{project_name}/services/{service_name}/nodeGroups/serverType"

    def get_node_group_failover_path(self, project_name, service_name, node_group_name):
        """Provide the API endpoint path for node group failover."""
        return f"/projects/{project_name}/services/{service_name}/nodeGroups/{node_group_name}/failover"
