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 .with_form_patch_response_custom_values_toggle_val import WithFormPatchResponse_customValues_toggleVal
    from .with_form_patch_response_custom_values_value_name import WithFormPatchResponse_customValues_valueName

@dataclass
class WithFormPatchResponse_customValues(Parsable):
    # Multi select values.
    array_val: Optional[str] = None
    # A single select value.
    choice_val: Optional[str] = None
    # A date value.
    date_val: Optional[str] = None
    # The unique identifier of the field.
    field_id: Optional[str] = None
    # The field's label or question text.
    item_label: Optional[str] = None
    # Text for the field's notes section.Max length: 8000
    notes: Optional[str] = None
    # A numeric value.
    number_val: Optional[float] = None
    # Name of the section containing this field.
    section_label: Optional[str] = None
    # A signature value (base64 encoded SVG).
    svg_val: Optional[str] = None
    # A text value.
    text_val: Optional[str] = None
    # A boolean like enum value.Possible values: ``Yes``, ``No``, ``False``, ``True``, ``Minus``, ``Plus``, ``Fail``, ``Pass``, ``NA``
    toggle_val: Optional[WithFormPatchResponse_customValues_toggleVal] = None
    # Indicates the type of value used for this item.Possible values: ``textVal``, ``toggleVal``, ``arrayVal``, ``numberVal``, ``choiceVal``, ``dateVal``, ``svgVal``
    value_name: Optional[WithFormPatchResponse_customValues_valueName] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithFormPatchResponse_customValues:
        """
        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: WithFormPatchResponse_customValues
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithFormPatchResponse_customValues()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .with_form_patch_response_custom_values_toggle_val import WithFormPatchResponse_customValues_toggleVal
        from .with_form_patch_response_custom_values_value_name import WithFormPatchResponse_customValues_valueName

        from .with_form_patch_response_custom_values_toggle_val import WithFormPatchResponse_customValues_toggleVal
        from .with_form_patch_response_custom_values_value_name import WithFormPatchResponse_customValues_valueName

        fields: dict[str, Callable[[Any], None]] = {
            "arrayVal": lambda n : setattr(self, 'array_val', n.get_str_value()),
            "choiceVal": lambda n : setattr(self, 'choice_val', n.get_str_value()),
            "dateVal": lambda n : setattr(self, 'date_val', n.get_str_value()),
            "fieldId": lambda n : setattr(self, 'field_id', n.get_str_value()),
            "itemLabel": lambda n : setattr(self, 'item_label', n.get_str_value()),
            "notes": lambda n : setattr(self, 'notes', n.get_str_value()),
            "numberVal": lambda n : setattr(self, 'number_val', n.get_float_value()),
            "sectionLabel": lambda n : setattr(self, 'section_label', n.get_str_value()),
            "svgVal": lambda n : setattr(self, 'svg_val', n.get_str_value()),
            "textVal": lambda n : setattr(self, 'text_val', n.get_str_value()),
            "toggleVal": lambda n : setattr(self, 'toggle_val', n.get_enum_value(WithFormPatchResponse_customValues_toggleVal)),
            "valueName": lambda n : setattr(self, 'value_name', n.get_enum_value(WithFormPatchResponse_customValues_valueName)),
        }
        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("arrayVal", self.array_val)
        writer.write_str_value("choiceVal", self.choice_val)
        writer.write_str_value("dateVal", self.date_val)
        writer.write_str_value("fieldId", self.field_id)
        writer.write_str_value("itemLabel", self.item_label)
        writer.write_str_value("notes", self.notes)
        writer.write_float_value("numberVal", self.number_val)
        writer.write_str_value("sectionLabel", self.section_label)
        writer.write_str_value("svgVal", self.svg_val)
        writer.write_str_value("textVal", self.text_val)
        writer.write_enum_value("toggleVal", self.toggle_val)
        writer.write_enum_value("valueName", self.value_name)
    

