# coding: utf-8

"""
TrueFoundry ML API

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

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

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

from __future__ import annotations

import json
import pprint
import re  # noqa: F401
from typing import Optional

from truefoundry.ml._autogen.client.models.artifact_type import ArtifactType
from truefoundry.ml._autogen.client.models.artifact_version_status import (
    ArtifactVersionStatus,
)
from truefoundry.pydantic_v1 import BaseModel, StrictBool, StrictInt, StrictStr, conlist


class ListArtifactVersionsRequestDto(BaseModel):
    """
    ListArtifactVersionsRequestDto
    """

    artifact_id: Optional[StrictStr] = None
    statuses: Optional[conlist(ArtifactVersionStatus)] = None
    max_results: Optional[StrictInt] = None
    offset: Optional[StrictInt] = None
    page_token: Optional[StrictStr] = None
    run_ids: Optional[conlist(StrictStr)] = None
    artifact_types: Optional[conlist(ArtifactType)] = None
    run_steps: Optional[conlist(StrictInt)] = None
    include_internal_metadata: Optional[StrictBool] = False
    include_model_versions: Optional[StrictBool] = False
    __properties = [
        "artifact_id",
        "statuses",
        "max_results",
        "offset",
        "page_token",
        "run_ids",
        "artifact_types",
        "run_steps",
        "include_internal_metadata",
        "include_model_versions",
    ]

    class Config:
        """Pydantic configuration"""

        allow_population_by_field_name = True
        validate_assignment = True

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

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

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

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> ListArtifactVersionsRequestDto:
        """Create an instance of ListArtifactVersionsRequestDto from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return ListArtifactVersionsRequestDto.parse_obj(obj)

        _obj = ListArtifactVersionsRequestDto.parse_obj(
            {
                "artifact_id": obj.get("artifact_id"),
                "statuses": obj.get("statuses"),
                "max_results": obj.get("max_results"),
                "offset": obj.get("offset"),
                "page_token": obj.get("page_token"),
                "run_ids": obj.get("run_ids"),
                "artifact_types": obj.get("artifact_types"),
                "run_steps": obj.get("run_steps"),
                "include_internal_metadata": obj.get("include_internal_metadata")
                if obj.get("include_internal_metadata") is not None
                else False,
                "include_model_versions": obj.get("include_model_versions")
                if obj.get("include_model_versions") is not None
                else False,
            }
        )
        return _obj
