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

if TYPE_CHECKING:
    from .values_batch_update_put_response_tabular_values_equipment_entries import ValuesBatchUpdatePutResponse_tabularValues_equipmentEntries
    from .values_batch_update_put_response_tabular_values_materials_entries import ValuesBatchUpdatePutResponse_tabularValues_materialsEntries
    from .values_batch_update_put_response_tabular_values_worklog_entries import ValuesBatchUpdatePutResponse_tabularValues_worklogEntries

@dataclass
class ValuesBatchUpdatePutResponse_tabularValues(Parsable):
    # Entries associated with equipment table in a Form.
    equipment_entries: Optional[list[ValuesBatchUpdatePutResponse_tabularValues_equipmentEntries]] = None
    # Entries associated with materials table in a Form.
    materials_entries: Optional[list[ValuesBatchUpdatePutResponse_tabularValues_materialsEntries]] = None
    # Entries associated with work log table in a Form.
    worklog_entries: Optional[list[ValuesBatchUpdatePutResponse_tabularValues_worklogEntries]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> ValuesBatchUpdatePutResponse_tabularValues:
        """
        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: ValuesBatchUpdatePutResponse_tabularValues
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return ValuesBatchUpdatePutResponse_tabularValues()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .values_batch_update_put_response_tabular_values_equipment_entries import ValuesBatchUpdatePutResponse_tabularValues_equipmentEntries
        from .values_batch_update_put_response_tabular_values_materials_entries import ValuesBatchUpdatePutResponse_tabularValues_materialsEntries
        from .values_batch_update_put_response_tabular_values_worklog_entries import ValuesBatchUpdatePutResponse_tabularValues_worklogEntries

        from .values_batch_update_put_response_tabular_values_equipment_entries import ValuesBatchUpdatePutResponse_tabularValues_equipmentEntries
        from .values_batch_update_put_response_tabular_values_materials_entries import ValuesBatchUpdatePutResponse_tabularValues_materialsEntries
        from .values_batch_update_put_response_tabular_values_worklog_entries import ValuesBatchUpdatePutResponse_tabularValues_worklogEntries

        fields: dict[str, Callable[[Any], None]] = {
            "equipmentEntries": lambda n : setattr(self, 'equipment_entries', n.get_collection_of_object_values(ValuesBatchUpdatePutResponse_tabularValues_equipmentEntries)),
            "materialsEntries": lambda n : setattr(self, 'materials_entries', n.get_collection_of_object_values(ValuesBatchUpdatePutResponse_tabularValues_materialsEntries)),
            "worklogEntries": lambda n : setattr(self, 'worklog_entries', n.get_collection_of_object_values(ValuesBatchUpdatePutResponse_tabularValues_worklogEntries)),
        }
        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_collection_of_object_values("equipmentEntries", self.equipment_entries)
        writer.write_collection_of_object_values("materialsEntries", self.materials_entries)
        writer.write_collection_of_object_values("worklogEntries", self.worklog_entries)
    

