"""Spaces API endpoints.

This file is automatically @generated from the Meraki API specification.
Do not edit this file manually.

"""

from __future__ import annotations

import urllib.parse
from typing import TYPE_CHECKING

from meraki_client.schemas import (
    GetOrganizationSpacesIntegrateStatusResponse,
    RemoveOrganizationSpacesIntegrationResponse,
)

if TYPE_CHECKING:
    from meraki_client.aio._session import Session


class Spaces:
    """Spaces class."""

    def __init__(self, session: Session) -> None:
        self._session = session

    async def get_organization_spaces_integrate_status(
        self, organization_id: str
    ) -> GetOrganizationSpacesIntegrateStatusResponse:
        """Get the status of the Spaces integration in Meraki.

        [API documentation: getOrganizationSpacesIntegrateStatus](https://developer.cisco.com/meraki/api-v1/#!get-organization-spaces-integrate-status)

        Args:
            organization_id: Organization ID.

        Returns:
            Successful operation.

        Example API response:
            ```json
            {
              "status": true,
              "states": [
                "Spaces account created",
                "Meraki Organization Import initiated",
                "Importing Meraki Organization Administrators",
                "Invite email sent to meraki-user@cisco.com"
              ],
              "email": "meraki-user@cisco.com",
              "accountName": "My First Meraki Org",
              "accountType": "Extend"
            }
            ```

        """
        organization_id = urllib.parse.quote(str(organization_id), safe="")
        path = f"/organizations/{organization_id}/spaces/integrate/status"

        return await self._session.get(
            scope="spaces",
            operation_id="getOrganizationSpacesIntegrateStatus",
            path=path,
            response_schema=GetOrganizationSpacesIntegrateStatusResponse,
        )

    async def remove_organization_spaces_integration(
        self, organization_id: str
    ) -> RemoveOrganizationSpacesIntegrationResponse:
        """Remove the Spaces integration from Meraki.

        [API documentation: removeOrganizationSpacesIntegration](https://developer.cisco.com/meraki/api-v1/#!remove-organization-spaces-integration)

        Args:
            organization_id: Organization ID.

        Returns:
            Successful operation.

        Example API response:
            ```json
            {
              "status": true,
              "message": "Succesfully fetched the spaces dashboard access"
            }
            ```

        """
        organization_id = urllib.parse.quote(str(organization_id), safe="")
        path = f"/organizations/{organization_id}/spaces/integration/remove"

        return await self._session.post(
            scope="spaces",
            operation_id="removeOrganizationSpacesIntegration",
            path=path,
            response_schema=RemoveOrganizationSpacesIntegrationResponse,
        )
