from __future__ import annotations
import datetime
from collections.abc import Callable
from dataclasses import dataclass, field
from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter
from typing import Any, Optional, TYPE_CHECKING, Union
from uuid import UUID

if TYPE_CHECKING:
    from .with_transmittal_get_response_display_recipients import WithTransmittalGetResponse_displayRecipients
    from .with_transmittal_get_response_external_members import WithTransmittalGetResponse_externalMembers
    from .with_transmittal_get_response_packed_status import WithTransmittalGetResponse_packedStatus
    from .with_transmittal_get_response_recipients import WithTransmittalGetResponse_recipients
    from .with_transmittal_get_response_sent_by import WithTransmittalGetResponse_sentBy
    from .with_transmittal_get_response_status import WithTransmittalGetResponse_status

@dataclass
class WithTransmittalGetResponse(Parsable):
    # The date and time when the transmittal was created, in ISO 8601 format.
    created_at: Optional[datetime.datetime] = None
    # Specifies how much recipient information each recipient can see.- ``ALL`` – All recipients can view the full recipient list.- ``LIMITED`` – Each recipient can view only their own recipient information.Project Admins and the sender always see the full list.Possible values: ``ALL``, ``LIMITED``
    display_recipients: Optional[WithTransmittalGetResponse_displayRecipients] = None
    # The total number of documents included in the transmittal.
    documents_count: Optional[int] = None
    # The list of external recipients who are not members of the project.
    external_members: Optional[list[WithTransmittalGetResponse_externalMembers]] = None
    # The unique identifier of the transmittal.
    id: Optional[UUID] = None
    # An optional message included with the transmittal.
    message: Optional[str] = None
    # Indicates the progress of packaging transmittal files into a ZIP archive.Possible values: ``SUCCESS``, ``PARTIAL_SUCCESS``, ``FAILED``, ``PROCESSING``, ``EXPIRED``, ``NOT_ALLOWED``
    packed_status: Optional[WithTransmittalGetResponse_packedStatus] = None
    # The list of recipients included in the transmittal, grouped by user, company, and role.For more information on how to add recipients to a transmittal, see the `Create Transmittals <https://help.autodesk.com/view/BUILD/ENU/?guid=Create_Transmittal&p=DOCS>`_ documentation.
    recipients: Optional[list[WithTransmittalGetResponse_recipients]] = None
    # Information about the user who created and sent the transmittal.
    sent_by: Optional[WithTransmittalGetResponse_sentBy] = None
    # A project-specific number automatically assigned when the transmittal is first submitted. It identifies the transmittal within the project and reflects the order in which it was created.
    sequence_id: Optional[str] = None
    # The current processing state of the transmittal.- ``SENDING`` – The transmittal is being processed or packaged; some fields may be temporarily empty. The ``recipients`` and ``externalMembers`` fields may be temporarily empty.- ``COMPLETED`` – The transmittal has been successfully issued and all data is available.- ``FAILED`` – The transmittal failed to process or send.Possible values: ``SENDING``, ``COMPLETED``, ``FAILED``.
    status: Optional[WithTransmittalGetResponse_status] = None
    # The title of the transmittal.
    title: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithTransmittalGetResponse:
        """
        Creates a new instance of the appropriate class based on discriminator value
        param parse_node: The parse node to use to read the discriminator value and create the object
        Returns: WithTransmittalGetResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithTransmittalGetResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .with_transmittal_get_response_display_recipients import WithTransmittalGetResponse_displayRecipients
        from .with_transmittal_get_response_external_members import WithTransmittalGetResponse_externalMembers
        from .with_transmittal_get_response_packed_status import WithTransmittalGetResponse_packedStatus
        from .with_transmittal_get_response_recipients import WithTransmittalGetResponse_recipients
        from .with_transmittal_get_response_sent_by import WithTransmittalGetResponse_sentBy
        from .with_transmittal_get_response_status import WithTransmittalGetResponse_status

        from .with_transmittal_get_response_display_recipients import WithTransmittalGetResponse_displayRecipients
        from .with_transmittal_get_response_external_members import WithTransmittalGetResponse_externalMembers
        from .with_transmittal_get_response_packed_status import WithTransmittalGetResponse_packedStatus
        from .with_transmittal_get_response_recipients import WithTransmittalGetResponse_recipients
        from .with_transmittal_get_response_sent_by import WithTransmittalGetResponse_sentBy
        from .with_transmittal_get_response_status import WithTransmittalGetResponse_status

        fields: dict[str, Callable[[Any], None]] = {
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "displayRecipients": lambda n : setattr(self, 'display_recipients', n.get_enum_value(WithTransmittalGetResponse_displayRecipients)),
            "documentsCount": lambda n : setattr(self, 'documents_count', n.get_int_value()),
            "externalMembers": lambda n : setattr(self, 'external_members', n.get_collection_of_object_values(WithTransmittalGetResponse_externalMembers)),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "message": lambda n : setattr(self, 'message', n.get_str_value()),
            "packedStatus": lambda n : setattr(self, 'packed_status', n.get_enum_value(WithTransmittalGetResponse_packedStatus)),
            "recipients": lambda n : setattr(self, 'recipients', n.get_collection_of_object_values(WithTransmittalGetResponse_recipients)),
            "sentBy": lambda n : setattr(self, 'sent_by', n.get_object_value(WithTransmittalGetResponse_sentBy)),
            "sequenceId": lambda n : setattr(self, 'sequence_id', n.get_str_value()),
            "status": lambda n : setattr(self, 'status', n.get_enum_value(WithTransmittalGetResponse_status)),
            "title": lambda n : setattr(self, 'title', n.get_str_value()),
        }
        return fields
    
    def serialize(self,writer: SerializationWriter) -> None:
        """
        Serializes information the current object
        param writer: Serialization writer to use to serialize this model
        Returns: None
        """
        if writer is None:
            raise TypeError("writer cannot be null.")
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_enum_value("displayRecipients", self.display_recipients)
        writer.write_int_value("documentsCount", self.documents_count)
        writer.write_collection_of_object_values("externalMembers", self.external_members)
        writer.write_uuid_value("id", self.id)
        writer.write_str_value("message", self.message)
        writer.write_enum_value("packedStatus", self.packed_status)
        writer.write_collection_of_object_values("recipients", self.recipients)
        writer.write_object_value("sentBy", self.sent_by)
        writer.write_str_value("sequenceId", self.sequence_id)
        writer.write_enum_value("status", self.status)
        writer.write_str_value("title", self.title)
    

