from __future__ import annotations
import datetime
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_assignee_type import WithFormPatchResponse_assigneeType
    from .with_form_patch_response_custom_values import WithFormPatchResponse_customValues
    from .with_form_patch_response_form_template import WithFormPatchResponse_formTemplate
    from .with_form_patch_response_pdf_values import WithFormPatchResponse_pdfValues
    from .with_form_patch_response_status import WithFormPatchResponse_status
    from .with_form_patch_response_tabular_values import WithFormPatchResponse_tabularValues
    from .with_form_patch_response_weather import WithFormPatchResponse_weather

@dataclass
class WithFormPatchResponse(Parsable):
    # The unique identifier of the user, role, or company the form is assigned to.
    assignee_id: Optional[str] = None
    # Type of entity the form is assigned to.Possible values: ``company``, ``role``, ``user``
    assignee_type: Optional[WithFormPatchResponse_assigneeType] = None
    # When form was created on the server, UTC date and time in ISO-8601 format.
    created_at: Optional[datetime.datetime] = None
    # The unique identifier of the user who created the form.
    created_by: Optional[str] = None
    # For non-PDF forms, data stored in the form fields.
    custom_values: Optional[list[WithFormPatchResponse_customValues]] = None
    # Text for the form's description section.
    description: Optional[str] = None
    # Date the form pertains to.
    form_date: Optional[str] = None
    # A chronological user-fiendly identifier of the form within the project e.g. form #5.
    form_num: Optional[int] = None
    # Information about the form's template.
    form_template: Optional[WithFormPatchResponse_formTemplate] = None
    # The unique identifier of the form.
    id: Optional[str] = None
    # Unique identifier for the user that last re-opened the Form (if applicable).
    last_reopened_by: Optional[str] = None
    # Signature of the reviewer who last submitted the Form (if applicable). Signature value (base64 encoded SVG).
    last_submitter_signature: Optional[str] = None
    # Location identifier associated with the form. For more information about the location, see `GET nodes </en/docs/acc/v1/reference/http/locations-nodes-GET/>`_.
    location_id: Optional[str] = None
    # The name of the form instance.Max length: 100
    name: Optional[str] = None
    # Text for the form's notes section.
    notes: Optional[str] = None
    # For PDF forms, the URL to download the form's PDF.
    pdf_url: Optional[str] = None
    # For PDF forms, values extracted from fields in the PDF.
    pdf_values: Optional[list[WithFormPatchResponse_pdfValues]] = None
    # The unique identifier of the project the form belongs to.
    project_id: Optional[str] = None
    # The current status of the form. Note that forms are created in ``draft`` status. Possible values:``draft``: you can edit forms.``inReview``: you cannot edit forms, however, they can be approved by form reviewers.``submitted``: forms are closed and no longer editable.``archived`` forms are not edtiable and hidden in the UI.
    status: Optional[WithFormPatchResponse_status] = None
    # For non-PDF forms, data stored in the tables on the form.
    tabular_values: Optional[list[WithFormPatchResponse_tabularValues]] = None
    # When form was last updated, UTC date and time in ISO-8601 format.
    updated_at: Optional[datetime.datetime] = None
    # When form was created on the client, UTC date and time in ISO-8601 format.
    user_created_at: Optional[datetime.datetime] = None
    # Weather forecast captured on the form.
    weather: Optional[list[WithFormPatchResponse_weather]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithFormPatchResponse:
        """
        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
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithFormPatchResponse()
    
    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_assignee_type import WithFormPatchResponse_assigneeType
        from .with_form_patch_response_custom_values import WithFormPatchResponse_customValues
        from .with_form_patch_response_form_template import WithFormPatchResponse_formTemplate
        from .with_form_patch_response_pdf_values import WithFormPatchResponse_pdfValues
        from .with_form_patch_response_status import WithFormPatchResponse_status
        from .with_form_patch_response_tabular_values import WithFormPatchResponse_tabularValues
        from .with_form_patch_response_weather import WithFormPatchResponse_weather

        from .with_form_patch_response_assignee_type import WithFormPatchResponse_assigneeType
        from .with_form_patch_response_custom_values import WithFormPatchResponse_customValues
        from .with_form_patch_response_form_template import WithFormPatchResponse_formTemplate
        from .with_form_patch_response_pdf_values import WithFormPatchResponse_pdfValues
        from .with_form_patch_response_status import WithFormPatchResponse_status
        from .with_form_patch_response_tabular_values import WithFormPatchResponse_tabularValues
        from .with_form_patch_response_weather import WithFormPatchResponse_weather

        fields: dict[str, Callable[[Any], None]] = {
            "assigneeId": lambda n : setattr(self, 'assignee_id', n.get_str_value()),
            "assigneeType": lambda n : setattr(self, 'assignee_type', n.get_enum_value(WithFormPatchResponse_assigneeType)),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "createdBy": lambda n : setattr(self, 'created_by', n.get_str_value()),
            "customValues": lambda n : setattr(self, 'custom_values', n.get_collection_of_object_values(WithFormPatchResponse_customValues)),
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "formDate": lambda n : setattr(self, 'form_date', n.get_str_value()),
            "formNum": lambda n : setattr(self, 'form_num', n.get_int_value()),
            "formTemplate": lambda n : setattr(self, 'form_template', n.get_object_value(WithFormPatchResponse_formTemplate)),
            "id": lambda n : setattr(self, 'id', n.get_str_value()),
            "lastReopenedBy": lambda n : setattr(self, 'last_reopened_by', n.get_str_value()),
            "lastSubmitterSignature": lambda n : setattr(self, 'last_submitter_signature', n.get_str_value()),
            "locationId": lambda n : setattr(self, 'location_id', n.get_str_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "notes": lambda n : setattr(self, 'notes', n.get_str_value()),
            "pdfUrl": lambda n : setattr(self, 'pdf_url', n.get_str_value()),
            "pdfValues": lambda n : setattr(self, 'pdf_values', n.get_collection_of_object_values(WithFormPatchResponse_pdfValues)),
            "projectId": lambda n : setattr(self, 'project_id', n.get_str_value()),
            "status": lambda n : setattr(self, 'status', n.get_enum_value(WithFormPatchResponse_status)),
            "tabularValues": lambda n : setattr(self, 'tabular_values', n.get_collection_of_object_values(WithFormPatchResponse_tabularValues)),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_datetime_value()),
            "userCreatedAt": lambda n : setattr(self, 'user_created_at', n.get_datetime_value()),
            "weather": lambda n : setattr(self, 'weather', n.get_collection_of_object_values(WithFormPatchResponse_weather)),
        }
        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("assigneeId", self.assignee_id)
        writer.write_enum_value("assigneeType", self.assignee_type)
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_str_value("createdBy", self.created_by)
        writer.write_collection_of_object_values("customValues", self.custom_values)
        writer.write_str_value("description", self.description)
        writer.write_str_value("formDate", self.form_date)
        writer.write_int_value("formNum", self.form_num)
        writer.write_object_value("formTemplate", self.form_template)
        writer.write_str_value("id", self.id)
        writer.write_str_value("lastReopenedBy", self.last_reopened_by)
        writer.write_str_value("lastSubmitterSignature", self.last_submitter_signature)
        writer.write_str_value("locationId", self.location_id)
        writer.write_str_value("name", self.name)
        writer.write_str_value("notes", self.notes)
        writer.write_str_value("pdfUrl", self.pdf_url)
        writer.write_collection_of_object_values("pdfValues", self.pdf_values)
        writer.write_str_value("projectId", self.project_id)
        writer.write_enum_value("status", self.status)
        writer.write_collection_of_object_values("tabularValues", self.tabular_values)
        writer.write_datetime_value("updatedAt", self.updated_at)
        writer.write_datetime_value("userCreatedAt", self.user_created_at)
        writer.write_collection_of_object_values("weather", self.weather)
    

