r"""
    This code was generated by
   ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
    |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
    |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \

    Twilio - Intelligence
    This is the public Twilio REST API.

    NOTE: This class is auto generated by OpenAPI Generator.
    https://openapi-generator.tech
    Do not edit the class manually.
"""

from typing import Any, Dict, List, Optional, Union
from twilio.base import serialize, values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
from twilio.base.version import Version


class EncryptedOperatorResultsInstance(InstanceResource):
    """
    :ivar locations: The locations of the encrypted operator results.
    :ivar transcript_sid:
    :ivar url:
    """

    def __init__(self, version: Version, payload: Dict[str, Any], transcript_sid: str):
        super().__init__(version)

        self.locations: Optional[List[str]] = payload.get("locations")
        self.transcript_sid: Optional[str] = payload.get("transcript_sid")
        self.url: Optional[str] = payload.get("url")

        self._solution = {
            "transcript_sid": transcript_sid,
        }
        self._context: Optional[EncryptedOperatorResultsContext] = None

    @property
    def _proxy(self) -> "EncryptedOperatorResultsContext":
        """
        Generate an instance context for the instance, the context is capable of
        performing various actions. All instance actions are proxied to the context

        :returns: EncryptedOperatorResultsContext for this EncryptedOperatorResultsInstance
        """
        if self._context is None:
            self._context = EncryptedOperatorResultsContext(
                self._version,
                transcript_sid=self._solution["transcript_sid"],
            )
        return self._context

    def fetch(
        self, redacted: Union[bool, object] = values.unset
    ) -> "EncryptedOperatorResultsInstance":
        """
        Fetch the EncryptedOperatorResultsInstance

        :param redacted: Grant access to PII Redacted/Unredacted Operator Results. If redaction is enabled, the default is `true` to access redacted operator results.

        :returns: The fetched EncryptedOperatorResultsInstance
        """
        return self._proxy.fetch(
            redacted=redacted,
        )

    async def fetch_async(
        self, redacted: Union[bool, object] = values.unset
    ) -> "EncryptedOperatorResultsInstance":
        """
        Asynchronous coroutine to fetch the EncryptedOperatorResultsInstance

        :param redacted: Grant access to PII Redacted/Unredacted Operator Results. If redaction is enabled, the default is `true` to access redacted operator results.

        :returns: The fetched EncryptedOperatorResultsInstance
        """
        return await self._proxy.fetch_async(
            redacted=redacted,
        )

    def __repr__(self) -> str:
        """
        Provide a friendly representation

        :returns: Machine friendly representation
        """
        context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
        return "<Twilio.Intelligence.V2.EncryptedOperatorResultsInstance {}>".format(
            context
        )


class EncryptedOperatorResultsContext(InstanceContext):

    def __init__(self, version: Version, transcript_sid: str):
        """
        Initialize the EncryptedOperatorResultsContext

        :param version: Version that contains the resource
        :param transcript_sid: The unique SID identifier of the Transcript.
        """
        super().__init__(version)

        # Path Solution
        self._solution = {
            "transcript_sid": transcript_sid,
        }
        self._uri = "/Transcripts/{transcript_sid}/OperatorResults/Encrypted".format(
            **self._solution
        )

    def fetch(
        self, redacted: Union[bool, object] = values.unset
    ) -> EncryptedOperatorResultsInstance:
        """
        Fetch the EncryptedOperatorResultsInstance

        :param redacted: Grant access to PII Redacted/Unredacted Operator Results. If redaction is enabled, the default is `true` to access redacted operator results.

        :returns: The fetched EncryptedOperatorResultsInstance
        """

        params = values.of(
            {
                "Redacted": serialize.boolean_to_string(redacted),
            }
        )

        headers = values.of({})

        headers["Accept"] = "application/json"

        payload = self._version.fetch(
            method="GET", uri=self._uri, params=params, headers=headers
        )

        return EncryptedOperatorResultsInstance(
            self._version,
            payload,
            transcript_sid=self._solution["transcript_sid"],
        )

    async def fetch_async(
        self, redacted: Union[bool, object] = values.unset
    ) -> EncryptedOperatorResultsInstance:
        """
        Asynchronous coroutine to fetch the EncryptedOperatorResultsInstance

        :param redacted: Grant access to PII Redacted/Unredacted Operator Results. If redaction is enabled, the default is `true` to access redacted operator results.

        :returns: The fetched EncryptedOperatorResultsInstance
        """

        params = values.of(
            {
                "Redacted": serialize.boolean_to_string(redacted),
            }
        )

        headers = values.of({})

        headers["Accept"] = "application/json"

        payload = await self._version.fetch_async(
            method="GET", uri=self._uri, params=params, headers=headers
        )

        return EncryptedOperatorResultsInstance(
            self._version,
            payload,
            transcript_sid=self._solution["transcript_sid"],
        )

    def __repr__(self) -> str:
        """
        Provide a friendly representation

        :returns: Machine friendly representation
        """
        context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
        return "<Twilio.Intelligence.V2.EncryptedOperatorResultsContext {}>".format(
            context
        )


class EncryptedOperatorResultsList(ListResource):

    def __init__(self, version: Version, transcript_sid: str):
        """
        Initialize the EncryptedOperatorResultsList

        :param version: Version that contains the resource
        :param transcript_sid: The unique SID identifier of the Transcript.

        """
        super().__init__(version)

        # Path Solution
        self._solution = {
            "transcript_sid": transcript_sid,
        }

    def get(self) -> EncryptedOperatorResultsContext:
        """
        Constructs a EncryptedOperatorResultsContext

        """
        return EncryptedOperatorResultsContext(
            self._version, transcript_sid=self._solution["transcript_sid"]
        )

    def __call__(self) -> EncryptedOperatorResultsContext:
        """
        Constructs a EncryptedOperatorResultsContext

        """
        return EncryptedOperatorResultsContext(
            self._version, transcript_sid=self._solution["transcript_sid"]
        )

    def __repr__(self) -> str:
        """
        Provide a friendly representation

        :returns: Machine friendly representation
        """
        return "<Twilio.Intelligence.V2.EncryptedOperatorResultsList>"
