from __future__ import annotations
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

@dataclass
class PerformanceTrackingItemInstancesPatchRequestBody(Parsable):
    # The overriding output quantity that you specified to reflect a change (if any) in the scope of the tracking item instance. This value will be used instead of the value of ``outputQuantity`` in future performance tracking and forecasting for this tracking item instance.
    adjusted_output_quantity: Optional[float] = None
    # The input quantity of the tracking item instance. You can multiply this by the value of ``inputUnitPrice`` to determine the planned total for this instance.
    input_quantity: Optional[float] = None
    # The input unit of measurement of the tracking item instance. This value should always be ``hr``.
    input_unit: Optional[str] = None
    # The input unit price of the tracking item instance. You can multiply this by the value of ``inputQuantity`` to determine the planned total for this instance.
    input_unit_price: Optional[float] = 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 locked performance tracking item instance field. You can lock the performance tracking item instance's planned total (``plannedTotal``) when calculating a item instance if you're updating a single value.
    locked_fields: Optional[str] = None
    # The user-provided name of the tracking item instance.
    name: Optional[str] = None
    # The user-provided or system generated code representing the tracking item instance.
    number: Optional[str] = None
    # The output quantity of the tracking item instance. You can multiply this by the value of ``outputUnitPrice`` to determine the planned total for this instance.
    output_quantity: Optional[float] = None
    # The output unit of measurement of the tracking item instance.
    output_unit: Optional[str] = None
    # The output unit price of the tracking item instance. You can multiply this by the value of ``outputQuantity`` to determine the planned total for this instance.
    output_unit_price: Optional[float] = None
    # The reported hours worked so far on the tracking item instance.
    tracked_input_quantity: Optional[float] = None
    # The reported quantity of material used so far on the tracking item instance
    tracked_output_quantity: Optional[float] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> PerformanceTrackingItemInstancesPatchRequestBody:
        """
        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: PerformanceTrackingItemInstancesPatchRequestBody
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return PerformanceTrackingItemInstancesPatchRequestBody()
    
    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]] = {
            "adjustedOutputQuantity": lambda n : setattr(self, 'adjusted_output_quantity', n.get_float_value()),
            "inputQuantity": lambda n : setattr(self, 'input_quantity', n.get_float_value()),
            "inputUnit": lambda n : setattr(self, 'input_unit', n.get_str_value()),
            "inputUnitPrice": lambda n : setattr(self, 'input_unit_price', n.get_float_value()),
            "locations": lambda n : setattr(self, 'locations', n.get_collection_of_primitive_values(str)),
            "lockedFields": lambda n : setattr(self, 'locked_fields', n.get_str_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "number": lambda n : setattr(self, 'number', 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()),
            "outputUnitPrice": lambda n : setattr(self, 'output_unit_price', n.get_float_value()),
            "trackedInputQuantity": lambda n : setattr(self, 'tracked_input_quantity', n.get_float_value()),
            "trackedOutputQuantity": lambda n : setattr(self, 'tracked_output_quantity', 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_float_value("adjustedOutputQuantity", self.adjusted_output_quantity)
        writer.write_float_value("inputQuantity", self.input_quantity)
        writer.write_str_value("inputUnit", self.input_unit)
        writer.write_float_value("inputUnitPrice", self.input_unit_price)
        writer.write_collection_of_primitive_values("locations", self.locations)
        writer.write_str_value("lockedFields", self.locked_fields)
        writer.write_str_value("name", self.name)
        writer.write_str_value("number", self.number)
        writer.write_float_value("outputQuantity", self.output_quantity)
        writer.write_str_value("outputUnit", self.output_unit)
        writer.write_float_value("outputUnitPrice", self.output_unit_price)
        writer.write_float_value("trackedInputQuantity", self.tracked_input_quantity)
        writer.write_float_value("trackedOutputQuantity", self.tracked_output_quantity)
    

