# coding: utf-8

"""
    SDK

    算想云对开发者提供的API

    The version of the OpenAPI document: v1
    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, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class JobCreateReq(BaseModel):
    """
    JobCreateReq
    """ # noqa: E501
    cpod_id: Optional[StrictStr] = None
    gpu_number: StrictInt = Field(alias="gpuNumber")
    gpu_type: StrictStr = Field(alias="gpuType")
    ckpt_path: StrictStr = Field(alias="ckptPath")
    ckpt_vol: StrictInt = Field(alias="ckptVol")
    created_model_path: StrictStr
    created_model_vol: StrictInt
    image_path: StrictStr = Field(alias="imagePath")
    job_type: StrictStr = Field(alias="jobType")
    stop_type: Optional[StrictInt] = Field(default=None, alias="stopType")
    stop_time: Optional[StrictInt] = Field(default=None, alias="stopTime")
    model_id: Optional[StrictStr] = Field(default=None, description=" 模型ID")
    model_name: Optional[StrictStr] = Field(default=None, description=" 模型名字, owner/model")
    model_path: Optional[StrictStr] = Field(default=None, description=" 模型的绑定路径")
    model_size: Optional[StrictInt] = Field(default=None, description=" 模型体积，单位字节")
    model_is_public: Optional[StrictBool] = Field(default=None, description=" 是否公共模型")
    model_template: Optional[StrictStr] = Field(default=None, description=" 模型的推理模版")
    model_meta: Optional[StrictStr] = Field(default=None, description=" 元信息")
    model_category: Optional[StrictStr] = Field(default=None, description=" 模型分类")
    dataset_id: Optional[StrictStr] = Field(default=None, description=" 数据集ID")
    dataset_name: Optional[StrictStr] = Field(default=None, description=" 数据集名字, owner/dataset")
    dataset_path: Optional[StrictStr] = Field(default=None, description=" 数据集的绑定路径")
    dataset_size: Optional[StrictInt] = Field(default=None, description=" 数据集体积，单位字节")
    dataset_is_public: Optional[StrictBool] = Field(default=None, description=" 是否公共数据集")
    trained_model_name: Optional[StrictStr] = Field(default=None, alias="trainedModelName")
    run_command: Optional[StrictStr] = Field(default=None, alias="runCommand")
    callback_url: Optional[StrictStr] = Field(default=None, alias="callbackUrl")
    __properties: ClassVar[List[str]] = ["cpod_id", "gpuNumber", "gpuType", "ckptPath", "ckptVol", "created_model_path", "created_model_vol", "imagePath", "jobType", "stopType", "stopTime", "model_id", "model_name", "model_path", "model_size", "model_is_public", "model_template", "model_meta", "model_category", "dataset_id", "dataset_name", "dataset_path", "dataset_size", "dataset_is_public", "trainedModelName", "runCommand", "callbackUrl"]

    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 JobCreateReq 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 JobCreateReq from a dict"""
        if obj is None:
            return None

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

        _obj = cls.model_validate({
            "cpod_id": obj.get("cpod_id"),
            "gpuNumber": obj.get("gpuNumber"),
            "gpuType": obj.get("gpuType"),
            "ckptPath": obj.get("ckptPath"),
            "ckptVol": obj.get("ckptVol"),
            "created_model_path": obj.get("created_model_path"),
            "created_model_vol": obj.get("created_model_vol"),
            "imagePath": obj.get("imagePath"),
            "jobType": obj.get("jobType"),
            "stopType": obj.get("stopType"),
            "stopTime": obj.get("stopTime"),
            "model_id": obj.get("model_id"),
            "model_name": obj.get("model_name"),
            "model_path": obj.get("model_path"),
            "model_size": obj.get("model_size"),
            "model_is_public": obj.get("model_is_public"),
            "model_template": obj.get("model_template"),
            "model_meta": obj.get("model_meta"),
            "model_category": obj.get("model_category"),
            "dataset_id": obj.get("dataset_id"),
            "dataset_name": obj.get("dataset_name"),
            "dataset_path": obj.get("dataset_path"),
            "dataset_size": obj.get("dataset_size"),
            "dataset_is_public": obj.get("dataset_is_public"),
            "trainedModelName": obj.get("trainedModelName"),
            "runCommand": obj.get("runCommand"),
            "callbackUrl": obj.get("callbackUrl")
        })
        return _obj


