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 .requirements_get_response_spec_sections_submittal_groups_submittal_group import RequirementsGetResponse_specSections_submittalGroups_submittalGroup
    from .requirements_get_response_spec_sections_submittal_groups_submittal_group_types import RequirementsGetResponse_specSections_submittalGroups_submittalGroupTypes

@dataclass
class RequirementsGetResponse_specSections_submittalGroups(Parsable):
    # The submittal group associcated with the submittal. This is equivalent to the *Submittal group* column in the UI.Possible values: ``ACTION AND INFORMATIONAL``, ``CLOSEOUT SUBMITTALS``, ``DIVISION 01 REQUIREMENTS``, ``FIELD QUALITY CONTROL``, ``Mockups``, ``QUALITY ASSURANCE``, ``Tests And Inspections``
    submittal_group: Optional[RequirementsGetResponse_specSections_submittalGroups_submittalGroup] = None
    # The submittalGroupTypes property
    submittal_group_types: Optional[list[RequirementsGetResponse_specSections_submittalGroups_submittalGroupTypes]] = None
    # The number of submittals for the submittal group.
    total: Optional[int] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> RequirementsGetResponse_specSections_submittalGroups:
        """
        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: RequirementsGetResponse_specSections_submittalGroups
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return RequirementsGetResponse_specSections_submittalGroups()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .requirements_get_response_spec_sections_submittal_groups_submittal_group import RequirementsGetResponse_specSections_submittalGroups_submittalGroup
        from .requirements_get_response_spec_sections_submittal_groups_submittal_group_types import RequirementsGetResponse_specSections_submittalGroups_submittalGroupTypes

        from .requirements_get_response_spec_sections_submittal_groups_submittal_group import RequirementsGetResponse_specSections_submittalGroups_submittalGroup
        from .requirements_get_response_spec_sections_submittal_groups_submittal_group_types import RequirementsGetResponse_specSections_submittalGroups_submittalGroupTypes

        fields: dict[str, Callable[[Any], None]] = {
            "submittalGroup": lambda n : setattr(self, 'submittal_group', n.get_enum_value(RequirementsGetResponse_specSections_submittalGroups_submittalGroup)),
            "submittalGroupTypes": lambda n : setattr(self, 'submittal_group_types', n.get_collection_of_object_values(RequirementsGetResponse_specSections_submittalGroups_submittalGroupTypes)),
            "total": lambda n : setattr(self, 'total', n.get_int_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("submittalGroup", self.submittal_group)
        writer.write_collection_of_object_values("submittalGroupTypes", self.submittal_group_types)
        writer.write_int_value("total", self.total)
    

