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 .comments_post_response_source import CommentsPostResponse_source

@dataclass
class CommentsPostResponse(Parsable):
    # The content of the comment.
    body: Optional[str] = None
    # The timestamp of the date and time the comment was created, in the following format: ``YYYY-MM-DDThh:mm:ss.sz``.
    created_at: Optional[datetime.datetime] = None
    # The Autodesk ID of the user who created the comment.To check the name of the user, call `GET users </en/docs/acc/v1/reference/http/admin-v1-projects-projectId-users-GET>`_.
    created_by: Optional[str] = None
    # The unique identifier of the comment.
    id: Optional[str] = None
    # The ID of the RFI associated with this comment.
    rfi_id: Optional[str] = None
    # The source of the comment. Indicates how the comment was created.Possible values:- ``web`` – The comment was created through the web interface or API.- ``email`` – The comment was created by replying via email.
    source: Optional[CommentsPostResponse_source] = None
    # The timestamp of the date and time the comment was updated, in the following format: ``YYYY-MM-DDThh:mm:ss.sz``.
    updated_at: Optional[datetime.datetime] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> CommentsPostResponse:
        """
        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: CommentsPostResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return CommentsPostResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .comments_post_response_source import CommentsPostResponse_source

        from .comments_post_response_source import CommentsPostResponse_source

        fields: dict[str, Callable[[Any], None]] = {
            "body": lambda n : setattr(self, 'body', n.get_str_value()),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "createdBy": lambda n : setattr(self, 'created_by', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_str_value()),
            "rfiId": lambda n : setattr(self, 'rfi_id', n.get_str_value()),
            "source": lambda n : setattr(self, 'source', n.get_enum_value(CommentsPostResponse_source)),
            "updatedAt": lambda n : setattr(self, 'updated_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("body", self.body)
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_str_value("createdBy", self.created_by)
        writer.write_str_value("id", self.id)
        writer.write_str_value("rfiId", self.rfi_id)
        writer.write_enum_value("source", self.source)
        writer.write_datetime_value("updatedAt", self.updated_at)
    

