# This file was generated by liblab | https://liblab.com/

from .utils.validator import Validator
from .utils.base_service import BaseService
from ..net.transport.serializer import Serializer
from ..models.utils.cast_models import cast_models
from ..models.equity_stakeholders_container import EquityStakeholdersContainer


class CartaService(BaseService):

    @cast_models
    def get_equity_stakeholders(
        self, limit: float = None, cursor: str = None
    ) -> EquityStakeholdersContainer:
        """Retrieve all stakeholders for Carta.

        :param limit: Return a page of results with given number of records; NOTE technically ALL query parameters are strings or array of strings, defaults to None
        :type limit: float, optional
        :param cursor: Return next page of results after given cursor., defaults to None
        :type cursor: str, optional
        ...
        :raises RequestError: Raised when a request fails, with optional HTTP status code and details.
        ...
        :return: Successful operation.
        :rtype: EquityStakeholdersContainer
        """

        Validator(float).is_optional().min(1).max(99).validate(limit)
        Validator(str).is_optional().validate(cursor)

        serialized_request = (
            Serializer(
                f"{self.base_url}/equity/stakeholders", self.get_default_headers()
            )
            .add_query("limit", limit)
            .add_query("cursor", cursor)
            .serialize()
            .set_method("GET")
        )

        response = self.send_request(serialized_request)

        return EquityStakeholdersContainer._unmap(response)
