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 TimeSheetsGetResponse_results(Parsable):
    # The BIM 360/ACC ID of the user who made the last change to the timesheet.
    changed_by: Optional[str] = None
    # The ID of the cost container for the project to which the timesheet belongs.
    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 BIM 360/ACC ID of the user who created the timesheet.
    creator_id: Optional[str] = None
    # The last date of the time period covered by the timesheet. This is also the date that the tracked ``inputQuantity`` and ``outputQuantity`` values are considered to have been reported.
    end_date: Optional[str] = None
    # The ID of the timesheet.
    id: Optional[UUID] = None
    # The hours worked during the time period covered by the timesheet.
    input_quantity: Optional[float] = None
    # The input unit of measurement of the timesheet. Currently this value should always be ``hr``.
    input_unit: Optional[str] = None
    # The quantity of material used during time period covered by the timesheet.
    output_quantity: Optional[float] = None
    # The output unit of measurement of the timesheet.
    output_unit: Optional[str] = None
    # The first date of the time period covered by the timesheet.
    start_date: Optional[str] = None
    # The ID of the tracking item instance to which the timesheet belongs.
    tracking_item_instance_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) -> TimeSheetsGetResponse_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: TimeSheetsGetResponse_results
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return TimeSheetsGetResponse_results()
    
    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]] = {
            "changedBy": lambda n : setattr(self, 'changed_by', 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()),
            "creatorId": lambda n : setattr(self, 'creator_id', n.get_str_value()),
            "endDate": lambda n : setattr(self, 'end_date', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "inputQuantity": lambda n : setattr(self, 'input_quantity', n.get_float_value()),
            "inputUnit": lambda n : setattr(self, 'input_unit', n.get_str_value()),
            "outputQuantity": lambda n : setattr(self, 'output_quantity', n.get_float_value()),
            "outputUnit": lambda n : setattr(self, 'output_unit', n.get_str_value()),
            "startDate": lambda n : setattr(self, 'start_date', n.get_str_value()),
            "trackingItemInstanceId": lambda n : setattr(self, 'tracking_item_instance_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_str_value("changedBy", self.changed_by)
        writer.write_uuid_value("containerId", self.container_id)
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_str_value("creatorId", self.creator_id)
        writer.write_str_value("endDate", self.end_date)
        writer.write_uuid_value("id", self.id)
        writer.write_float_value("inputQuantity", self.input_quantity)
        writer.write_str_value("inputUnit", self.input_unit)
        writer.write_float_value("outputQuantity", self.output_quantity)
        writer.write_str_value("outputUnit", self.output_unit)
        writer.write_str_value("startDate", self.start_date)
        writer.write_uuid_value("trackingItemInstanceId", self.tracking_item_instance_id)
        writer.write_datetime_value("updatedAt", self.updated_at)
    

