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 .reviews_post_response_archived_by import ReviewsPostResponse_archivedBy
    from .reviews_post_response_created_by import ReviewsPostResponse_createdBy
    from .reviews_post_response_next_action_by import ReviewsPostResponse_nextActionBy
    from .reviews_post_response_status import ReviewsPostResponse_status

@dataclass
class ReviewsPostResponse(Parsable):
    # Indicates whether the review has been archived.``true``: the review is archived.``false``: (default) the review is active.
    archived: Optional[bool] = None
    # The date and time when the review was archived. If the review has not been archived, this value is ``null``.
    archived_at: Optional[datetime.datetime] = None
    # Information about the user who archived the review.
    archived_by: Optional[ReviewsPostResponse_archivedBy] = None
    # The date time when the review was initiated.
    created_at: Optional[datetime.datetime] = None
    # Information about the user who initiated the review.
    created_by: Optional[ReviewsPostResponse_createdBy] = None
    # The due date of the current step.
    current_step_due_date: Optional[datetime.datetime] = None
    # The ID of the current step in the review.
    current_step_id: Optional[str] = None
    # The date time when the review was completed.
    finished_at: Optional[datetime.datetime] = None
    # The unique identifier of the review.
    id: Optional[UUID] = None
    # The name of the review.
    name: Optional[str] = None
    # Information about the claimers and candidates responsible for the current step.
    next_action_by: Optional[list[ReviewsPostResponse_nextActionBy]] = None
    # A unique, auto-incrementing number assigned to the review when it is first submitted.This ID does not change, even if the review is sent back to the initiator and goes through multiple rounds.It identifies the review within the project and reflects the order in which reviews were created.
    sequence_id: Optional[int] = None
    # The current status of the review.Possible values: ``OPEN``, ``CLOSED``, ``VOID``, ``FAILED``.
    status: Optional[ReviewsPostResponse_status] = None
    # The date time when the review was last updated.
    updated_at: Optional[datetime.datetime] = None
    # The unique identifier (UUID) of the approval workflow used to create this review.
    workflow_id: Optional[UUID] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> ReviewsPostResponse:
        """
        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: ReviewsPostResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return ReviewsPostResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .reviews_post_response_archived_by import ReviewsPostResponse_archivedBy
        from .reviews_post_response_created_by import ReviewsPostResponse_createdBy
        from .reviews_post_response_next_action_by import ReviewsPostResponse_nextActionBy
        from .reviews_post_response_status import ReviewsPostResponse_status

        from .reviews_post_response_archived_by import ReviewsPostResponse_archivedBy
        from .reviews_post_response_created_by import ReviewsPostResponse_createdBy
        from .reviews_post_response_next_action_by import ReviewsPostResponse_nextActionBy
        from .reviews_post_response_status import ReviewsPostResponse_status

        fields: dict[str, Callable[[Any], None]] = {
            "archived": lambda n : setattr(self, 'archived', n.get_bool_value()),
            "archivedAt": lambda n : setattr(self, 'archived_at', n.get_datetime_value()),
            "archivedBy": lambda n : setattr(self, 'archived_by', n.get_object_value(ReviewsPostResponse_archivedBy)),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "createdBy": lambda n : setattr(self, 'created_by', n.get_object_value(ReviewsPostResponse_createdBy)),
            "currentStepDueDate": lambda n : setattr(self, 'current_step_due_date', n.get_datetime_value()),
            "currentStepId": lambda n : setattr(self, 'current_step_id', n.get_str_value()),
            "finishedAt": lambda n : setattr(self, 'finished_at', n.get_datetime_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "nextActionBy": lambda n : setattr(self, 'next_action_by', n.get_collection_of_object_values(ReviewsPostResponse_nextActionBy)),
            "sequenceId": lambda n : setattr(self, 'sequence_id', n.get_int_value()),
            "status": lambda n : setattr(self, 'status', n.get_enum_value(ReviewsPostResponse_status)),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_datetime_value()),
            "workflowId": lambda n : setattr(self, 'workflow_id', n.get_uuid_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_bool_value("archived", self.archived)
        writer.write_datetime_value("archivedAt", self.archived_at)
        writer.write_object_value("archivedBy", self.archived_by)
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_object_value("createdBy", self.created_by)
        writer.write_datetime_value("currentStepDueDate", self.current_step_due_date)
        writer.write_str_value("currentStepId", self.current_step_id)
        writer.write_datetime_value("finishedAt", self.finished_at)
        writer.write_uuid_value("id", self.id)
        writer.write_str_value("name", self.name)
        writer.write_collection_of_object_values("nextActionBy", self.next_action_by)
        writer.write_int_value("sequenceId", self.sequence_id)
        writer.write_enum_value("status", self.status)
        writer.write_datetime_value("updatedAt", self.updated_at)
        writer.write_uuid_value("workflowId", self.workflow_id)
    

