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
from uuid import UUID

if TYPE_CHECKING:
    from .forms_post_request_body_assignee_type import FormsPostRequestBody_assigneeType

@dataclass
class FormsPostRequestBody(Parsable):
    # Identifier of the company, role, or user assigned to the form. Note: the assignee must be a contributor of the template.
    assignee_id: Optional[str] = None
    # Type of entity to assign the form to.Possible values: ``company``, ``role``, ``user``
    assignee_type: Optional[FormsPostRequestBody_assigneeType] = None
    # Text for the form description field.Max length: 8000
    description: Optional[str] = None
    # Date the form pertains to, must be after 1950-01-01.
    form_date: Optional[str] = None
    # The unique identifier of the form. If you do not specify an ID, one will be assigned.
    id: Optional[UUID] = None
    # Location 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[UUID] = None
    # The name of the form instance. If the specified value is ``null`` or empty, it defaults to the form's template name.Max length: 100
    name: Optional[str] = None
    # Text for the form's notes section.Max length: 8000
    notes: Optional[str] = None
    # Date and time indicating when form was created on the client or external system (optional).
    user_created_at: Optional[datetime.datetime] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> FormsPostRequestBody:
        """
        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: FormsPostRequestBody
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return FormsPostRequestBody()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .forms_post_request_body_assignee_type import FormsPostRequestBody_assigneeType

        from .forms_post_request_body_assignee_type import FormsPostRequestBody_assigneeType

        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(FormsPostRequestBody_assigneeType)),
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "formDate": lambda n : setattr(self, 'form_date', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "locationId": lambda n : setattr(self, 'location_id', n.get_uuid_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "notes": lambda n : setattr(self, 'notes', n.get_str_value()),
            "userCreatedAt": lambda n : setattr(self, 'user_created_at', n.get_datetime_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("assigneeId", self.assignee_id)
        writer.write_enum_value("assigneeType", self.assignee_type)
        writer.write_str_value("description", self.description)
        writer.write_str_value("formDate", self.form_date)
        writer.write_uuid_value("id", self.id)
        writer.write_uuid_value("locationId", self.location_id)
        writer.write_str_value("name", self.name)
        writer.write_str_value("notes", self.notes)
        writer.write_datetime_value("userCreatedAt", self.user_created_at)
    

