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

if TYPE_CHECKING:
    from .with_issue_patch_request_body_custom_attributes import WithIssuePatchRequestBody_customAttributes
    from .with_issue_patch_request_body_gps_coordinates import WithIssuePatchRequestBody_gpsCoordinates
    from .with_issue_patch_request_body_status import WithIssuePatchRequestBody_status

@dataclass
class WithIssuePatchRequestBody(Parsable):
    # The Autodesk ID of the member, role, or company you want to assign to the issue. Note that if you select an assignee ID, you also need to select a type (``assignedToType``).We do not currently provide endpoints to programmatically find the member, role, or company IDs that you are permitted to assign to the issue. We recommend using the Data Connector API to extract the permitted IDs. See the `Retrieve Available Members Roles and Companies </en/docs/acc/v1/tutorials/issues/retrieve-available-members-roles-companies>`_ tutorial for more details.
    assigned_to: Optional[str] = None
    # The type of the current assignee of this issue. Possible values: ``user``, ``company``, ``role``, ``null``. Note that if you select a type, you also need to select the assignee ID (``assignedTo``).
    assigned_to_type: Optional[str] = None
    # A list of custom attributes of the specific issue.
    custom_attributes: Optional[list[WithIssuePatchRequestBody_customAttributes]] = None
    # A brief description of the issue and its purpose. Maximum 1000 characters.
    description: Optional[str] = None
    # The due date of the issue, in ISO8601 format.
    due_date: Optional[str] = None
    # A GPS Coordinate which represents the geo location of the issue.
    gps_coordinates: Optional[WithIssuePatchRequestBody_gpsCoordinates] = None
    # The unique identifier of the subtype of the issue.
    issue_subtype_id: Optional[UUID] = None
    # The location related to the issue, provided as plain text. Maximum 250 characters.
    location_details: Optional[str] = None
    # The unique LBS (Location Breakdown Structure) identifier that relates to the issue.
    location_id: Optional[UUID] = None
    # The list of actions permitted for the user for this issue in its current state.Note that if a user with *View and assign to their company* permissions attempts to assign a user from a another company to the issue, it will return an error.Possible Values: ``assign_all`` (can assign another user from another company to the issue), ``assign_same_company`` (can only assign another user from the same company to the issue), ``clear_assignee``, ``delete``, ``add_comment``, ``add_attachment``, ``remove_attachment``.The following values are not relevant: ``add_attachment``, ``remove_attachment``.
    permitted_actions: Optional[list[str]] = None
    # States whether the issue is published. Default value: ``false`` (e.g. unpublished).
    published: Optional[bool] = None
    # The unique identifier of the type of root cause for the issue.
    root_cause_id: Optional[UUID] = None
    # Not relevant
    snapshot_has_markups: Optional[bool] = None
    # Not relevant
    snapshot_urn: Optional[str] = None
    # The start date of the issue, in ISO8601 format.
    start_date: Optional[str] = None
    # The current status of the issue. To check the available statuses for the project, call `GET users/me </en/docs/acc/v1/reference/http/issues-me-GET>`_ and check the permitted statuses list (``issue.new.permittedStatuses``). For more information about statuses, see the `Help documentation <https://help.autodesk.com/view/BUILD/ENU/?guid=Issues_Statuses>`_.Possible values: ``draft``, ``open``, ``pending``, ``in_progress``, ``completed``, ``in_review``, ``not_approved``, ``in_dispute``, ``closed``
    status: Optional[WithIssuePatchRequestBody_status] = None
    # The title of the issue. Maximum 100 characters.
    title: Optional[str] = None
    # The Autodesk ID of the member you want to assign as a watcher for the issue.We do not currently provide endpoints to programmatically find the member IDs that you are permitted to assign as watchers for the issue. We recommend using the Data Connector API to extract the permitted IDs. See the `Retrieve Available Members </en/docs/acc/v1/tutorials/issues/retrieve-available-members-roles-companies>`_ tutorial for more details.
    watchers: Optional[list[str]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithIssuePatchRequestBody:
        """
        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: WithIssuePatchRequestBody
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithIssuePatchRequestBody()
    
    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_issue_patch_request_body_custom_attributes import WithIssuePatchRequestBody_customAttributes
        from .with_issue_patch_request_body_gps_coordinates import WithIssuePatchRequestBody_gpsCoordinates
        from .with_issue_patch_request_body_status import WithIssuePatchRequestBody_status

        from .with_issue_patch_request_body_custom_attributes import WithIssuePatchRequestBody_customAttributes
        from .with_issue_patch_request_body_gps_coordinates import WithIssuePatchRequestBody_gpsCoordinates
        from .with_issue_patch_request_body_status import WithIssuePatchRequestBody_status

        fields: dict[str, Callable[[Any], None]] = {
            "assignedTo": lambda n : setattr(self, 'assigned_to', n.get_str_value()),
            "assignedToType": lambda n : setattr(self, 'assigned_to_type', n.get_str_value()),
            "customAttributes": lambda n : setattr(self, 'custom_attributes', n.get_collection_of_object_values(WithIssuePatchRequestBody_customAttributes)),
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "dueDate": lambda n : setattr(self, 'due_date', n.get_str_value()),
            "gpsCoordinates": lambda n : setattr(self, 'gps_coordinates', n.get_object_value(WithIssuePatchRequestBody_gpsCoordinates)),
            "issueSubtypeId": lambda n : setattr(self, 'issue_subtype_id', n.get_uuid_value()),
            "locationDetails": lambda n : setattr(self, 'location_details', n.get_str_value()),
            "locationId": lambda n : setattr(self, 'location_id', n.get_uuid_value()),
            "permittedActions": lambda n : setattr(self, 'permitted_actions', n.get_collection_of_primitive_values(str)),
            "published": lambda n : setattr(self, 'published', n.get_bool_value()),
            "rootCauseId": lambda n : setattr(self, 'root_cause_id', n.get_uuid_value()),
            "snapshotHasMarkups": lambda n : setattr(self, 'snapshot_has_markups', n.get_bool_value()),
            "snapshotUrn": lambda n : setattr(self, 'snapshot_urn', n.get_str_value()),
            "startDate": lambda n : setattr(self, 'start_date', n.get_str_value()),
            "status": lambda n : setattr(self, 'status', n.get_enum_value(WithIssuePatchRequestBody_status)),
            "title": lambda n : setattr(self, 'title', n.get_str_value()),
            "watchers": lambda n : setattr(self, 'watchers', n.get_collection_of_primitive_values(str)),
        }
        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("assignedTo", self.assigned_to)
        writer.write_str_value("assignedToType", self.assigned_to_type)
        writer.write_collection_of_object_values("customAttributes", self.custom_attributes)
        writer.write_str_value("description", self.description)
        writer.write_str_value("dueDate", self.due_date)
        writer.write_object_value("gpsCoordinates", self.gps_coordinates)
        writer.write_uuid_value("issueSubtypeId", self.issue_subtype_id)
        writer.write_str_value("locationDetails", self.location_details)
        writer.write_uuid_value("locationId", self.location_id)
        writer.write_collection_of_primitive_values("permittedActions", self.permitted_actions)
        writer.write_bool_value("published", self.published)
        writer.write_uuid_value("rootCauseId", self.root_cause_id)
        writer.write_bool_value("snapshotHasMarkups", self.snapshot_has_markups)
        writer.write_str_value("snapshotUrn", self.snapshot_urn)
        writer.write_str_value("startDate", self.start_date)
        writer.write_enum_value("status", self.status)
        writer.write_str_value("title", self.title)
        writer.write_collection_of_primitive_values("watchers", self.watchers)
    

