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

@dataclass
class PerformanceTrackingItemsGetResponse(Parsable):
    # The ID of the tracking item's underlying budget.
    budget_id: Optional[UUID] = None
    # The code of the tracking item's underlying budget.
    code: Optional[str] = None
    # The ID of the cost container for the project to which this tracking item belongs.
    container_id: Optional[UUID] = None
    # The description of the tracking item's underlying budget.
    description: Optional[str] = None
    # The ID of the tracking item.
    id: Optional[UUID] = None
    # A list of the IDs of the project locations where this item applies, along with the node paths of these locations in the project's locations tree.For more information, see the Locations `Help documentation <https://aps.autodesk.com/en/docs/bim360/v1/reference/http/locations-nodes-GET/>`_ help.
    location_paths: Optional[list[str]] = None
    # A list of the IDs of the project locations where this item applies.For more information, see the Locations `Help documentation <https://aps.autodesk.com/en/docs/bim360/v1/reference/http/locations-nodes-GET/>`_ help.
    locations: Optional[list[str]] = None
    # The name of the tracking item's underlying budget.
    name: Optional[str] = None
    # Original amount of the budget, equals to ``quantity`` * ``unitPrice``
    original_amount: Optional[float] = None
    # The planned end date of the performance tracking item's underlying budget.
    planned_end_date: Optional[datetime.datetime] = None
    # The planned start date of the performance tracking item's underlying budget.
    planned_start_date: Optional[datetime.datetime] = None
    # The quantity of the performance tracking item's underlying budget.
    quantity: Optional[float] = None
    # The unit of the performance tracking item's underlying budget.
    unit: Optional[str] = None
    # The unit price of the performance tracking item's underlying budget.
    unit_price: Optional[float] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> PerformanceTrackingItemsGetResponse:
        """
        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: PerformanceTrackingItemsGetResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return PerformanceTrackingItemsGetResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        fields: dict[str, Callable[[Any], None]] = {
            "budgetId": lambda n : setattr(self, 'budget_id', n.get_uuid_value()),
            "code": lambda n : setattr(self, 'code', n.get_str_value()),
            "containerId": lambda n : setattr(self, 'container_id', n.get_uuid_value()),
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "locationPaths": lambda n : setattr(self, 'location_paths', n.get_collection_of_primitive_values(str)),
            "locations": lambda n : setattr(self, 'locations', n.get_collection_of_primitive_values(str)),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "originalAmount": lambda n : setattr(self, 'original_amount', n.get_float_value()),
            "plannedEndDate": lambda n : setattr(self, 'planned_end_date', n.get_datetime_value()),
            "plannedStartDate": lambda n : setattr(self, 'planned_start_date', n.get_datetime_value()),
            "quantity": lambda n : setattr(self, 'quantity', n.get_float_value()),
            "unit": lambda n : setattr(self, 'unit', n.get_str_value()),
            "unitPrice": lambda n : setattr(self, 'unit_price', n.get_float_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("budgetId", self.budget_id)
        writer.write_str_value("code", self.code)
        writer.write_uuid_value("containerId", self.container_id)
        writer.write_str_value("description", self.description)
        writer.write_uuid_value("id", self.id)
        writer.write_collection_of_primitive_values("locationPaths", self.location_paths)
        writer.write_collection_of_primitive_values("locations", self.locations)
        writer.write_str_value("name", self.name)
        writer.write_float_value("originalAmount", self.original_amount)
        writer.write_datetime_value("plannedEndDate", self.planned_end_date)
        writer.write_datetime_value("plannedStartDate", self.planned_start_date)
        writer.write_float_value("quantity", self.quantity)
        writer.write_str_value("unit", self.unit)
        writer.write_float_value("unitPrice", self.unit_price)
    

