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 .taxes_get_response_results_options import TaxesGetResponse_results_options
    from .taxes_get_response_results_summary import TaxesGetResponse_results_summary

@dataclass
class TaxesGetResponse_results(Parsable):
    # The unique identifier (UUID) of the object the tax is associated with.
    association_id: Optional[UUID] = None
    # The type of object the tax is associated with.
    association_type: Optional[str] = None
    # Not relevant
    container_id: Optional[UUID] = None
    # The date and time that the item was created, in ISO 8601 format.
    created_at: Optional[datetime.datetime] = None
    # The unique identifier of the tax.
    id: Optional[UUID] = None
    # The name of the tax.Max length: 1024
    name: Optional[str] = None
    # Indicates whether the tax needs to be recalculated because the associated item was updated after the tax was applied.
    need_update: Optional[bool] = None
    # Not relevant
    options: Optional[TaxesGetResponse_results_options] = None
    # A consolidated report of all taxes applied within a specific project.
    summary: Optional[list[TaxesGetResponse_results_summary]] = None
    # Not relevant
    tax_formula_id: Optional[UUID] = None
    # The date and time that the item was last updated, in ISO 8601 format.
    updated_at: Optional[datetime.datetime] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> TaxesGetResponse_results:
        """
        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: TaxesGetResponse_results
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return TaxesGetResponse_results()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .taxes_get_response_results_options import TaxesGetResponse_results_options
        from .taxes_get_response_results_summary import TaxesGetResponse_results_summary

        from .taxes_get_response_results_options import TaxesGetResponse_results_options
        from .taxes_get_response_results_summary import TaxesGetResponse_results_summary

        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_str_value()),
            "containerId": lambda n : setattr(self, 'container_id', n.get_uuid_value()),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "needUpdate": lambda n : setattr(self, 'need_update', n.get_bool_value()),
            "options": lambda n : setattr(self, 'options', n.get_object_value(TaxesGetResponse_results_options)),
            "summary": lambda n : setattr(self, 'summary', n.get_collection_of_object_values(TaxesGetResponse_results_summary)),
            "taxFormulaId": lambda n : setattr(self, 'tax_formula_id', n.get_uuid_value()),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_datetime_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_str_value("associationType", self.association_type)
        writer.write_uuid_value("containerId", self.container_id)
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_uuid_value("id", self.id)
        writer.write_str_value("name", self.name)
        writer.write_bool_value("needUpdate", self.need_update)
        writer.write_object_value("options", self.options)
        writer.write_collection_of_object_values("summary", self.summary)
        writer.write_uuid_value("taxFormulaId", self.tax_formula_id)
        writer.write_datetime_value("updatedAt", self.updated_at)
    

