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_form_template_status import WithFormPatchResponse_formTemplate_status

@dataclass
class WithFormPatchResponse_formTemplate(Parsable):
    """
    Information about the form's template.
    """
    # The unique identifier of the template.
    id: Optional[str] = None
    # Name of the form template.
    name: Optional[str] = None
    # Unique indentifier of the project the template belongs to.
    project_id: Optional[str] = None
    # Possible values: ``active``, ``inactive``, ``deleted``
    status: Optional[WithFormPatchResponse_formTemplate_status] = None
    # User defined type of the form template.
    template_type: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithFormPatchResponse_formTemplate:
        """
        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_formTemplate
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithFormPatchResponse_formTemplate()
    
    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_form_template_status import WithFormPatchResponse_formTemplate_status

        from .with_form_patch_response_form_template_status import WithFormPatchResponse_formTemplate_status

        fields: dict[str, Callable[[Any], None]] = {
            "id": lambda n : setattr(self, 'id', n.get_str_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "projectId": lambda n : setattr(self, 'project_id', n.get_str_value()),
            "status": lambda n : setattr(self, 'status', n.get_enum_value(WithFormPatchResponse_formTemplate_status)),
            "templateType": lambda n : setattr(self, 'template_type', n.get_str_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_str_value("id", self.id)
        writer.write_str_value("name", self.name)
        writer.write_str_value("projectId", self.project_id)
        writer.write_enum_value("status", self.status)
        writer.write_str_value("templateType", self.template_type)
    

