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 import RequirementsGetResponse_specSections

@dataclass
class RequirementsGetResponse(Parsable):
    # The division code associated with the submittal. This is the equivalent to the *Division* column in the UI.
    division_code: Optional[str] = None
    # The division name associated with the submittal. This is equivalent to the name in the *Division* filter in the UI.
    division_name: Optional[str] = None
    # A list of specification divisions and groups.
    spec_sections: Optional[list[RequirementsGetResponse_specSections]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> RequirementsGetResponse:
        """
        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
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return RequirementsGetResponse()
    
    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 import RequirementsGetResponse_specSections

        from .requirements_get_response_spec_sections import RequirementsGetResponse_specSections

        fields: dict[str, Callable[[Any], None]] = {
            "divisionCode": lambda n : setattr(self, 'division_code', n.get_str_value()),
            "divisionName": lambda n : setattr(self, 'division_name', n.get_str_value()),
            "specSections": lambda n : setattr(self, 'spec_sections', n.get_collection_of_object_values(RequirementsGetResponse_specSections)),
        }
        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("divisionCode", self.division_code)
        writer.write_str_value("divisionName", self.division_name)
        writer.write_collection_of_object_values("specSections", self.spec_sections)
    

