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_takeoff_type_get_response_model_mappings import WithTakeoffTypeGetResponse_modelMappings
    from .with_takeoff_type_get_response_primary_quantity_definition import WithTakeoffTypeGetResponse_primaryQuantityDefinition
    from .with_takeoff_type_get_response_property_definitions import WithTakeoffTypeGetResponse_propertyDefinitions
    from .with_takeoff_type_get_response_secondary_quantity_definitions import WithTakeoffTypeGetResponse_secondaryQuantityDefinitions
    from .with_takeoff_type_get_response_shape_type import WithTakeoffTypeGetResponse_shapeType
    from .with_takeoff_type_get_response_tool import WithTakeoffTypeGetResponse_tool

@dataclass
class WithTakeoffTypeGetResponse(Parsable):
    # The color of the takeoff type as it appears on the sheet or model.A color is represented by a value consisting of 6 or 8 hexadecimal digits, prefixed with a hash (#) symbol. In the 6-digit notation, the first pair of digits represent the red channel, the middle pair of digits represent the green channel and the last pair of digits represent the blue channel. The color is completely opaque.The 8-digit notation follows the structure of the 6-digit notation, where the additional last 2-digits represent the alpha channel (``00`` is transparent and ``ff`` is fully opaque).
    border_color: Optional[str] = None
    # The color of the takeoff type as it appears on the sheet or model.A color is represented by a value consisting of 6 or 8 hexadecimal digits, prefixed with a hash (#) symbol. In the 6-digit notation, the first pair of digits represent the red channel, the middle pair of digits represent the green channel and the last pair of digits represent the blue channel. The color is completely opaque.The 8-digit notation follows the structure of the 6-digit notation, where the additional last 2-digits represent the alpha channel (``00`` is transparent and ``ff`` is fully opaque).
    color: Optional[str] = None
    # The size of the count marker.You must set this value in the UI.
    count_marker_size: Optional[float] = None
    # The date and time when the resource was created, in the following format: ``YYYY-MM-DDThh:mm:ssZ``.
    created_at: Optional[datetime.datetime] = None
    # A description of the takeoff type.Max length: 256
    description: Optional[str] = None
    # The takeoff type ID.
    id: Optional[UUID] = None
    # A list of model properties used to calculate output.Only relevant for 3D models.
    model_mappings: Optional[list[WithTakeoffTypeGetResponse_modelMappings]] = None
    # The takeoff type name.Max length: 64
    name: Optional[str] = None
    # The classification quantity details.
    primary_quantity_definition: Optional[WithTakeoffTypeGetResponse_primaryQuantityDefinition] = None
    # A list of additional, user provided parameters associated with a 2D takeoff type.
    property_definitions: Optional[list[WithTakeoffTypeGetResponse_propertyDefinitions]] = None
    # A list of secondary classification quantity details.
    secondary_quantity_definitions: Optional[list[WithTakeoffTypeGetResponse_secondaryQuantityDefinitions]] = None
    # The shape of the count marker.A count marker is one of the takeoff tool type options that is selected in the UI when creating a takeoff type.Possible values: ``CIRCLE``, ``TRIANGLE``, ``SQUARE``, ``DIAMOND``, ``CHECKMARK``.
    shape_type: Optional[WithTakeoffTypeGetResponse_shapeType] = None
    # The type of tool used to create takeoff items of this takeoff type.Possible values: ``COUNT``, ``DISTANCE``, ``AREA``, ``SELECT``.Corresponding UI names: ``COUNT``, ``LINEAR``, ``AREA``, ``BIM``.
    tool: Optional[WithTakeoffTypeGetResponse_tool] = None
    # The date and time when the resource was last updated, in the following format: ``YYYY-MM-DDThh:mm:ssZ``.
    updated_at: Optional[datetime.datetime] = None
    # The name of the user who last updated the resource.
    updated_by_name: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithTakeoffTypeGetResponse:
        """
        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: WithTakeoffTypeGetResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithTakeoffTypeGetResponse()
    
    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_takeoff_type_get_response_model_mappings import WithTakeoffTypeGetResponse_modelMappings
        from .with_takeoff_type_get_response_primary_quantity_definition import WithTakeoffTypeGetResponse_primaryQuantityDefinition
        from .with_takeoff_type_get_response_property_definitions import WithTakeoffTypeGetResponse_propertyDefinitions
        from .with_takeoff_type_get_response_secondary_quantity_definitions import WithTakeoffTypeGetResponse_secondaryQuantityDefinitions
        from .with_takeoff_type_get_response_shape_type import WithTakeoffTypeGetResponse_shapeType
        from .with_takeoff_type_get_response_tool import WithTakeoffTypeGetResponse_tool

        from .with_takeoff_type_get_response_model_mappings import WithTakeoffTypeGetResponse_modelMappings
        from .with_takeoff_type_get_response_primary_quantity_definition import WithTakeoffTypeGetResponse_primaryQuantityDefinition
        from .with_takeoff_type_get_response_property_definitions import WithTakeoffTypeGetResponse_propertyDefinitions
        from .with_takeoff_type_get_response_secondary_quantity_definitions import WithTakeoffTypeGetResponse_secondaryQuantityDefinitions
        from .with_takeoff_type_get_response_shape_type import WithTakeoffTypeGetResponse_shapeType
        from .with_takeoff_type_get_response_tool import WithTakeoffTypeGetResponse_tool

        fields: dict[str, Callable[[Any], None]] = {
            "borderColor": lambda n : setattr(self, 'border_color', n.get_str_value()),
            "color": lambda n : setattr(self, 'color', n.get_str_value()),
            "countMarkerSize": lambda n : setattr(self, 'count_marker_size', n.get_float_value()),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "modelMappings": lambda n : setattr(self, 'model_mappings', n.get_collection_of_object_values(WithTakeoffTypeGetResponse_modelMappings)),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "primaryQuantityDefinition": lambda n : setattr(self, 'primary_quantity_definition', n.get_object_value(WithTakeoffTypeGetResponse_primaryQuantityDefinition)),
            "propertyDefinitions": lambda n : setattr(self, 'property_definitions', n.get_collection_of_object_values(WithTakeoffTypeGetResponse_propertyDefinitions)),
            "secondaryQuantityDefinitions": lambda n : setattr(self, 'secondary_quantity_definitions', n.get_collection_of_object_values(WithTakeoffTypeGetResponse_secondaryQuantityDefinitions)),
            "shapeType": lambda n : setattr(self, 'shape_type', n.get_enum_value(WithTakeoffTypeGetResponse_shapeType)),
            "tool": lambda n : setattr(self, 'tool', n.get_enum_value(WithTakeoffTypeGetResponse_tool)),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_datetime_value()),
            "updatedByName": lambda n : setattr(self, 'updated_by_name', 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_str_value("borderColor", self.border_color)
        writer.write_str_value("color", self.color)
        writer.write_float_value("countMarkerSize", self.count_marker_size)
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_str_value("description", self.description)
        writer.write_uuid_value("id", self.id)
        writer.write_collection_of_object_values("modelMappings", self.model_mappings)
        writer.write_str_value("name", self.name)
        writer.write_object_value("primaryQuantityDefinition", self.primary_quantity_definition)
        writer.write_collection_of_object_values("propertyDefinitions", self.property_definitions)
        writer.write_collection_of_object_values("secondaryQuantityDefinitions", self.secondary_quantity_definitions)
        writer.write_enum_value("shapeType", self.shape_type)
        writer.write_enum_value("tool", self.tool)
        writer.write_datetime_value("updatedAt", self.updated_at)
        writer.write_str_value("updatedByName", self.updated_by_name)
    

