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 .documents_get_response_association_type import DocumentsGetResponse_associationType
    from .documents_get_response_error_info import DocumentsGetResponse_errorInfo
    from .documents_get_response_status import DocumentsGetResponse_status

@dataclass
class DocumentsGetResponse(Parsable):
    # The object ID of the item associated with the actions, such as a budget, contract, or cost item.
    association_id: Optional[UUID] = None
    # The type of item to which it is associated.Possible values: ``Budget``, ``Contract``, ``ScheduleOfValue``, ``FormInstance``, ``CostItem``, ``Payment``, ``MainContract``, ``BudgetPayment``, ``Expense``, ``CostPayment``, ``ExpenseItem``, ``PaymentItem``, ``OCO``, ``RCO``, ``SCO``, ``PCO``, ``RFQ``, ``DistributionItem``, ``BudgetTransfer``, ``Fee``
    association_type: Optional[DocumentsGetResponse_associationType] = None
    # The date and time that the item was created, in ISO 8601 format.
    created_at: Optional[datetime.datetime] = None
    # Error information if this document failed to be generated from the template.
    error_info: Optional[DocumentsGetResponse_errorInfo] = None
    # Unique auto-generated identifier of the generated document.
    id: Optional[UUID] = None
    # Not relevant
    job_id: Optional[float] = None
    # Not relevant
    pdf_urn: Optional[str] = None
    # Autodesk ID of the recipient, who is a project user inside BIM 360 Admin.
    recipient_id: Optional[str] = None
    # Not relevant
    signed_by: Optional[str] = None
    # Current status of the document. Possible values: ``Pending``, ``Started``, ``Completed``, ``Failed``, ``PendingSign``, ``Signed``.
    status: Optional[DocumentsGetResponse_status] = None
    # The date and time that the item was last updated, in ISO 8601 format.
    updated_at: Optional[datetime.datetime] = None
    # The version URN of the document with docx format in the Autodesk Data Management service.
    urn: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> DocumentsGetResponse:
        """
        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: DocumentsGetResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return DocumentsGetResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .documents_get_response_association_type import DocumentsGetResponse_associationType
        from .documents_get_response_error_info import DocumentsGetResponse_errorInfo
        from .documents_get_response_status import DocumentsGetResponse_status

        from .documents_get_response_association_type import DocumentsGetResponse_associationType
        from .documents_get_response_error_info import DocumentsGetResponse_errorInfo
        from .documents_get_response_status import DocumentsGetResponse_status

        fields: dict[str, Callable[[Any], None]] = {
            "associationId": lambda n : setattr(self, 'association_id', n.get_uuid_value()),
            "associationType": lambda n : setattr(self, 'association_type', n.get_enum_value(DocumentsGetResponse_associationType)),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "errorInfo": lambda n : setattr(self, 'error_info', n.get_object_value(DocumentsGetResponse_errorInfo)),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "jobId": lambda n : setattr(self, 'job_id', n.get_float_value()),
            "pdfUrn": lambda n : setattr(self, 'pdf_urn', n.get_str_value()),
            "recipientId": lambda n : setattr(self, 'recipient_id', n.get_str_value()),
            "signedBy": lambda n : setattr(self, 'signed_by', n.get_str_value()),
            "status": lambda n : setattr(self, 'status', n.get_enum_value(DocumentsGetResponse_status)),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_datetime_value()),
            "urn": lambda n : setattr(self, 'urn', 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_uuid_value("associationId", self.association_id)
        writer.write_enum_value("associationType", self.association_type)
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_object_value("errorInfo", self.error_info)
        writer.write_uuid_value("id", self.id)
        writer.write_float_value("jobId", self.job_id)
        writer.write_str_value("pdfUrn", self.pdf_urn)
        writer.write_str_value("recipientId", self.recipient_id)
        writer.write_str_value("signedBy", self.signed_by)
        writer.write_enum_value("status", self.status)
        writer.write_datetime_value("updatedAt", self.updated_at)
        writer.write_str_value("urn", self.urn)
    

