# coding: utf-8

"""
    Guardrails Hub Types

    Data structures used in the Guardrails Hub

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

class Tags(BaseModel):
    """
    Tags
    """ # noqa: E501
    language: Optional[List[StrictStr]] = None
    certification: Optional[List[StrictStr]] = None
    content_type: Optional[List[StrictStr]] = Field(default=None, alias="contentType")
    infrastructure_requirements: Optional[List[StrictStr]] = Field(default=None, alias="infrastructureRequirements")
    risk_category: Optional[List[StrictStr]] = Field(default=None, alias="riskCategory")
    use_cases: Optional[List[StrictStr]] = Field(default=None, alias="useCases")
    __properties: ClassVar[List[str]] = ["language", "certification", "contentType", "infrastructureRequirements", "riskCategory", "useCases"]

    @field_validator('language')
    def language_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        for i in value:
            if i not in set(['en', 'all']):
                raise ValueError("each list item must be one of ('en', 'all')")
        return value

    @field_validator('certification')
    def certification_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        for i in value:
            if i not in set(['Guardrails Certified']):
                raise ValueError("each list item must be one of ('Guardrails Certified')")
        return value

    @field_validator('content_type')
    def content_type_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        for i in value:
            if i not in set(['string', 'object', 'list', 'integer', 'float', 'sql', 'code', 'csv', 'python']):
                raise ValueError("each list item must be one of ('string', 'object', 'list', 'integer', 'float', 'sql', 'code', 'csv', 'python')")
        return value

    @field_validator('infrastructure_requirements')
    def infrastructure_requirements_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        for i in value:
            if i not in set(['ML', 'NA', 'LLM', 'Rule']):
                raise ValueError("each list item must be one of ('ML', 'NA', 'LLM', 'Rule')")
        return value

    @field_validator('risk_category')
    def risk_category_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        for i in value:
            if i not in set(['Etiquette', 'Brand risk', 'Formatting', 'Invalid Code', 'Jailbreaking', 'Factuality', 'Code Exploits', 'Data Leakage']):
                raise ValueError("each list item must be one of ('Etiquette', 'Brand risk', 'Formatting', 'Invalid Code', 'Jailbreaking', 'Factuality', 'Code Exploits', 'Data Leakage')")
        return value

    @field_validator('use_cases')
    def use_cases_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        for i in value:
            if i not in set(['Chatbots', 'Customer Support', 'Structured data', 'RAG', 'Structured Data', 'Summarization', 'CodeGen', 'Text2SQL']):
                raise ValueError("each list item must be one of ('Chatbots', 'Customer Support', 'Structured data', 'RAG', 'Structured Data', 'Summarization', 'CodeGen', 'Text2SQL')")
        return value

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

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

        _obj = cls.model_validate({
            "language": obj.get("language"),
            "certification": obj.get("certification"),
            "contentType": obj.get("contentType"),
            "infrastructureRequirements": obj.get("infrastructureRequirements"),
            "riskCategory": obj.get("riskCategory"),
            "useCases": obj.get("useCases")
        })
        return _obj


