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

@dataclass
class WithChangeOrderGetResponse_results_comments(Parsable):
    # The text content of the comment.
    content: Optional[str] = None
    # The date and time when the comment was created, in ISO 8601 format.
    created_at: Optional[str] = None
    # The BIM 360/ACC user ID of the comment's author. For details about the author, see `GET users </en/docs/acc/v1/reference/http/admin-projectsprojectId-users-GET/>`_.
    creator_id: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithChangeOrderGetResponse_results_comments:
        """
        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: WithChangeOrderGetResponse_results_comments
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithChangeOrderGetResponse_results_comments()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        fields: dict[str, Callable[[Any], None]] = {
            "content": lambda n : setattr(self, 'content', n.get_str_value()),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_str_value()),
            "creatorId": lambda n : setattr(self, 'creator_id', 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("content", self.content)
        writer.write_str_value("createdAt", self.created_at)
        writer.write_str_value("creatorId", self.creator_id)
    

