# coding: utf-8

"""
    Hindsight HTTP API

    HTTP API for Hindsight

    The version of the OpenAPI document: 0.4.22
    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_extensions import Annotated
from typing import Optional, Set
from typing_extensions import Self

class BankTemplateConfig(BaseModel):
    """
    Bank configuration fields within a template manifest.  Only includes configurable (per-bank) fields. Credential fields (API keys, base URLs) are intentionally excluded for security.
    """ # noqa: E501
    reflect_mission: Optional[StrictStr] = None
    retain_mission: Optional[StrictStr] = None
    retain_extraction_mode: Optional[StrictStr] = None
    retain_custom_instructions: Optional[StrictStr] = None
    retain_chunk_size: Optional[StrictInt] = None
    enable_observations: Optional[StrictBool] = None
    observations_mission: Optional[StrictStr] = None
    disposition_skepticism: Optional[Annotated[int, Field(le=5, strict=True, ge=1)]] = None
    disposition_literalism: Optional[Annotated[int, Field(le=5, strict=True, ge=1)]] = None
    disposition_empathy: Optional[Annotated[int, Field(le=5, strict=True, ge=1)]] = None
    entity_labels: Optional[List[StrictStr]] = None
    entities_allow_free_form: Optional[StrictBool] = None
    __properties: ClassVar[List[str]] = ["reflect_mission", "retain_mission", "retain_extraction_mode", "retain_custom_instructions", "retain_chunk_size", "enable_observations", "observations_mission", "disposition_skepticism", "disposition_literalism", "disposition_empathy", "entity_labels", "entities_allow_free_form"]

    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 BankTemplateConfig 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,
        )
        # set to None if reflect_mission (nullable) is None
        # and model_fields_set contains the field
        if self.reflect_mission is None and "reflect_mission" in self.model_fields_set:
            _dict['reflect_mission'] = None

        # set to None if retain_mission (nullable) is None
        # and model_fields_set contains the field
        if self.retain_mission is None and "retain_mission" in self.model_fields_set:
            _dict['retain_mission'] = None

        # set to None if retain_extraction_mode (nullable) is None
        # and model_fields_set contains the field
        if self.retain_extraction_mode is None and "retain_extraction_mode" in self.model_fields_set:
            _dict['retain_extraction_mode'] = None

        # set to None if retain_custom_instructions (nullable) is None
        # and model_fields_set contains the field
        if self.retain_custom_instructions is None and "retain_custom_instructions" in self.model_fields_set:
            _dict['retain_custom_instructions'] = None

        # set to None if retain_chunk_size (nullable) is None
        # and model_fields_set contains the field
        if self.retain_chunk_size is None and "retain_chunk_size" in self.model_fields_set:
            _dict['retain_chunk_size'] = None

        # set to None if enable_observations (nullable) is None
        # and model_fields_set contains the field
        if self.enable_observations is None and "enable_observations" in self.model_fields_set:
            _dict['enable_observations'] = None

        # set to None if observations_mission (nullable) is None
        # and model_fields_set contains the field
        if self.observations_mission is None and "observations_mission" in self.model_fields_set:
            _dict['observations_mission'] = None

        # set to None if disposition_skepticism (nullable) is None
        # and model_fields_set contains the field
        if self.disposition_skepticism is None and "disposition_skepticism" in self.model_fields_set:
            _dict['disposition_skepticism'] = None

        # set to None if disposition_literalism (nullable) is None
        # and model_fields_set contains the field
        if self.disposition_literalism is None and "disposition_literalism" in self.model_fields_set:
            _dict['disposition_literalism'] = None

        # set to None if disposition_empathy (nullable) is None
        # and model_fields_set contains the field
        if self.disposition_empathy is None and "disposition_empathy" in self.model_fields_set:
            _dict['disposition_empathy'] = None

        # set to None if entity_labels (nullable) is None
        # and model_fields_set contains the field
        if self.entity_labels is None and "entity_labels" in self.model_fields_set:
            _dict['entity_labels'] = None

        # set to None if entities_allow_free_form (nullable) is None
        # and model_fields_set contains the field
        if self.entities_allow_free_form is None and "entities_allow_free_form" in self.model_fields_set:
            _dict['entities_allow_free_form'] = None

        return _dict

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

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

        _obj = cls.model_validate({
            "reflect_mission": obj.get("reflect_mission"),
            "retain_mission": obj.get("retain_mission"),
            "retain_extraction_mode": obj.get("retain_extraction_mode"),
            "retain_custom_instructions": obj.get("retain_custom_instructions"),
            "retain_chunk_size": obj.get("retain_chunk_size"),
            "enable_observations": obj.get("enable_observations"),
            "observations_mission": obj.get("observations_mission"),
            "disposition_skepticism": obj.get("disposition_skepticism"),
            "disposition_literalism": obj.get("disposition_literalism"),
            "disposition_empathy": obj.get("disposition_empathy"),
            "entity_labels": obj.get("entity_labels"),
            "entities_allow_free_form": obj.get("entities_allow_free_form")
        })
        return _obj


