# coding: utf-8

"""
    Identity Security Cloud V2025 API

    Use these APIs to interact with the Identity Security Cloud platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs.

    The version of the OpenAPI document: v2025
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json
import warnings

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class TaskInfo(BaseModel):
    """
    TaskInfo
    """ # noqa: E501
    task_id: Optional[StrictInt] = Field(default=None, description="The unique identifier for the task.", alias="taskId")
    task_type_name: Optional[StrictStr] = Field(default=None, description="The type or category of the task.", alias="taskTypeName")
    start_time: Optional[StrictInt] = Field(default=None, description="The start time of the task, represented as epoch seconds.", alias="startTime")
    end_time: Optional[StrictInt] = Field(default=None, description="The end time of the task, represented as epoch seconds.", alias="endTime")
    task_name: Optional[StrictStr] = Field(default=None, description="The display name of the task.", alias="taskName")
    created_by_display_name: Optional[StrictStr] = Field(default=None, description="The display name of the user who created the task.", alias="createdByDisplayName")
    progress: Optional[StrictInt] = Field(default=None, description="The progress of the task, typically represented as a percentage (0-100).")
    status: Optional[StrictStr] = Field(default=None, description="The current status of the task (e.g., \"Running\", \"Completed\", \"Failed\").")
    details: Optional[StrictStr] = Field(default=None, description="Additional details or information about the task.")
    schedule_task_id: Optional[StrictInt] = Field(default=None, description="The unique identifier of the associated scheduled task, if applicable.", alias="scheduleTaskId")
    __properties: ClassVar[List[str]] = ["taskId", "taskTypeName", "startTime", "endTime", "taskName", "createdByDisplayName", "progress", "status", "details", "scheduleTaskId"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of TaskInfo from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # set to None if task_id (nullable) is None
        # and model_fields_set contains the field
        if self.task_id is None and "task_id" in self.model_fields_set:
            _dict['taskId'] = None

        # set to None if task_type_name (nullable) is None
        # and model_fields_set contains the field
        if self.task_type_name is None and "task_type_name" in self.model_fields_set:
            _dict['taskTypeName'] = None

        # set to None if start_time (nullable) is None
        # and model_fields_set contains the field
        if self.start_time is None and "start_time" in self.model_fields_set:
            _dict['startTime'] = None

        # set to None if end_time (nullable) is None
        # and model_fields_set contains the field
        if self.end_time is None and "end_time" in self.model_fields_set:
            _dict['endTime'] = None

        # set to None if task_name (nullable) is None
        # and model_fields_set contains the field
        if self.task_name is None and "task_name" in self.model_fields_set:
            _dict['taskName'] = None

        # set to None if created_by_display_name (nullable) is None
        # and model_fields_set contains the field
        if self.created_by_display_name is None and "created_by_display_name" in self.model_fields_set:
            _dict['createdByDisplayName'] = None

        # set to None if status (nullable) is None
        # and model_fields_set contains the field
        if self.status is None and "status" in self.model_fields_set:
            _dict['status'] = None

        # set to None if details (nullable) is None
        # and model_fields_set contains the field
        if self.details is None and "details" in self.model_fields_set:
            _dict['details'] = None

        # set to None if schedule_task_id (nullable) is None
        # and model_fields_set contains the field
        if self.schedule_task_id is None and "schedule_task_id" in self.model_fields_set:
            _dict['scheduleTaskId'] = None

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of TaskInfo from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "taskId": obj.get("taskId"),
            "taskTypeName": obj.get("taskTypeName"),
            "startTime": obj.get("startTime"),
            "endTime": obj.get("endTime"),
            "taskName": obj.get("taskName"),
            "createdByDisplayName": obj.get("createdByDisplayName"),
            "progress": obj.get("progress"),
            "status": obj.get("status"),
            "details": obj.get("details"),
            "scheduleTaskId": obj.get("scheduleTaskId")
        })
        return _obj


