# coding: utf-8

"""
    HCX API

    The HCX REST API. Please see https://api.ncloud-docs.com/docs/ai-naver-clovastudio-summary for more details.

    The version of the OpenAPI document: 24.1.5
    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

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

class TrainingTaskResultStatusInfo(BaseModel):
    """
    TrainingTaskResultStatusInfo
    """ # noqa: E501
    label: Optional[List[StrictStr]] = Field(default=None, description="Labels for classification task, null for generation task")
    data_rows: Optional[StrictInt] = Field(default=None, description="Number of data rows", alias="dataRows")
    num_of_tokens: Optional[StrictInt] = Field(default=None, description="Number of tokens in data", alias="numOfTokens")
    curr_step: Optional[StrictInt] = Field(default=None, description="Current step of training", alias="currStep")
    total_train_steps: Optional[StrictInt] = Field(default=None, description="Total steps of training", alias="totalTrainSteps")
    curr_epoch: Optional[StrictInt] = Field(default=None, description="Current epoch", alias="currEpoch")
    total_train_epochs: Optional[StrictInt] = Field(default=None, description="Total number of epochs for training", alias="totalTrainEpochs")
    estimated_time: Optional[StrictInt] = Field(default=None, description="Estimated time for completion", alias="estimatedTime")
    train_loss: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Training loss", alias="trainLoss")
    send_weight_success: Optional[StrictBool] = Field(default=None, description="Whether training results were successfully saved", alias="sendWeightSuccess")
    end_datetime: Optional[StrictStr] = Field(default=None, description="Training end date", alias="endDatetime")
    failure_reason: Optional[StrictStr] = Field(default=None, description="Reason for training failure", alias="failureReason")
    message: Optional[StrictStr] = Field(default=None, description="Detailed message for failure reason")
    __properties: ClassVar[List[str]] = ["label", "dataRows", "numOfTokens", "currStep", "totalTrainSteps", "currEpoch", "totalTrainEpochs", "estimatedTime", "trainLoss", "sendWeightSuccess", "endDatetime", "failureReason", "message"]

    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 TrainingTaskResultStatusInfo 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,
        )
        return _dict

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

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

        _obj = cls.model_validate({
            "label": obj.get("label"),
            "dataRows": obj.get("dataRows"),
            "numOfTokens": obj.get("numOfTokens"),
            "currStep": obj.get("currStep"),
            "totalTrainSteps": obj.get("totalTrainSteps"),
            "currEpoch": obj.get("currEpoch"),
            "totalTrainEpochs": obj.get("totalTrainEpochs"),
            "estimatedTime": obj.get("estimatedTime"),
            "trainLoss": obj.get("trainLoss"),
            "sendWeightSuccess": obj.get("sendWeightSuccess"),
            "endDatetime": obj.get("endDatetime"),
            "failureReason": obj.get("failureReason"),
            "message": obj.get("message")
        })
        return _obj


