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_request_body_tabular_values_columns_column_name import ValuesBatchUpdatePutRequestBody_tabularValues_columns_columnName

@dataclass
class ValuesBatchUpdatePutRequestBody_tabularValues_columns(Parsable):
    # The name of the column to update. Possible values:For the Work Log table:``trade`` (Crew) - use ``textVal``, ``timespan`` (Total hours) - use ``timespanVal``, ``headcount`` (workers) - use ``numberVal``, ``description`` (work performed) - use ``textVal``For the Equipment table:``item`` (equipment) - use ``textVal``, ``timespan`` (Hours used) -  use ``timespanVal``, ``quantity`` (Quantity) - use ``numberVal``, ``description`` (comment) - use ``textVal``For the Materials table:``item`` (Material) - use ``textVal``, ``quantity`` (Quantity) - use ``numberVal``, ``unit`` (Unit) - use ``textVal``, ``description`` (Comment) - use ``textVal``.
    column_name: Optional[ValuesBatchUpdatePutRequestBody_tabularValues_columns_columnName] = None
    # The attribute used for updating number columns. For example, ````numberVal``: ``42````.Each tabular field is assigned a specific value type, which you need to specify when updating the field. ``numberVal`` is relevant for updating the following columns: ``headcount`` (Workers) and ``quantity`` (Quantity).
    number_val: Optional[float] = None
    # The attribute used for updating text value columns.Each tabular field is assigned a specific value type, which you need to specify when updating the field. ``textVal`` is relevant for updating the following columns: ``description`` (Work performed), ``description`` (comment), ``item`` (Equipment), ``item`` (Material), ``trade`` (Crew), and ``unit`` (Unit).Max length: 8000
    text_val: Optional[str] = None
    # The attribute used for updating time-related columns.Each tabular field is assigned a specific value type, which you need to specify when updating the field. ``timespanVal`` is relevant for updating the following columns: ``timespan`` (Total hours), ``timespan`` (Hours used).
    timespan_val: Optional[float] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> ValuesBatchUpdatePutRequestBody_tabularValues_columns:
        """
        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: ValuesBatchUpdatePutRequestBody_tabularValues_columns
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return ValuesBatchUpdatePutRequestBody_tabularValues_columns()
    
    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_request_body_tabular_values_columns_column_name import ValuesBatchUpdatePutRequestBody_tabularValues_columns_columnName

        from .values_batch_update_put_request_body_tabular_values_columns_column_name import ValuesBatchUpdatePutRequestBody_tabularValues_columns_columnName

        fields: dict[str, Callable[[Any], None]] = {
            "columnName": lambda n : setattr(self, 'column_name', n.get_enum_value(ValuesBatchUpdatePutRequestBody_tabularValues_columns_columnName)),
            "numberVal": lambda n : setattr(self, 'number_val', n.get_float_value()),
            "textVal": lambda n : setattr(self, 'text_val', n.get_str_value()),
            "timespanVal": lambda n : setattr(self, 'timespan_val', 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_enum_value("columnName", self.column_name)
        writer.write_float_value("numberVal", self.number_val)
        writer.write_str_value("textVal", self.text_val)
        writer.write_float_value("timespanVal", self.timespan_val)
    

