# coding: utf-8

"""
    XingChen 开放接口定义

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

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

    Do not edit the class manually.
"""


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


from typing import Optional
from pydantic import BaseModel, Field, StrictInt, StrictStr

class CharacterKey(BaseModel):
    """
    CharacterKey
    """
    character_id: Optional[StrictStr] = Field(None, alias="characterId")
    version: Optional[StrictInt] = None
    name: Optional[StrictStr] = None
    content: Optional[StrictStr] = None
    type: Optional[StrictStr] = Field(None, alias="type", description="角色类型，虚拟角色-virtual（默认）, 角色复刻-reproduction，助手-assistant")
    task: Optional[StrictStr] = Field(None, alias="task", description="角色群聊任务")
    traits: Optional[StrictStr] = Field(None, alias="traits", description="强制要求")
    __properties = ["characterId", "version", "name", "content", "type", "task", "traits"]

    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) -> CharacterKey:
        """Create an instance of CharacterKey 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) -> CharacterKey:
        """Create an instance of CharacterKey from a dict"""
        if obj is None:
            return None

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

        _obj = CharacterKey.parse_obj({
            "character_id": obj.get("characterId"),
            "version": obj.get("version"),
            "name": obj.get("name"),
            "content": obj.get("content"),
            "task": obj.get("task"),
            "traits": obj.get("traits")
        })
        return _obj


