# coding: utf-8

"""
    Mixpeek API

    This is the Mixpeek API, providing access to various endpoints for data processing and retrieval.

    The version of the OpenAPI document: 0.81.1
    Contact: info@mixpeek.com
    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, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class StageDiscovery(BaseModel):
    """
    Extended stage discovery information with examples.  Includes everything from RetrieverStageDefinition plus usage examples and common patterns.
    """ # noqa: E501
    stage_id: StrictStr = Field(description="Unique identifier for the stage")
    description: StrictStr = Field(description="Human-readable description of stage behavior")
    category: StrictStr = Field(description="Transformation category: filter, sort, reduce, apply, enrich")
    icon: StrictStr = Field(description="Lucide React icon identifier")
    parameter_schema: Optional[Dict[str, Any]] = Field(default=None, description="JSON Schema for stage parameters")
    example_config: Optional[Dict[str, Any]] = Field(default=None, description="Example stage configuration")
    common_use_cases: Optional[List[StrictStr]] = Field(default=None, description="Common scenarios where this stage is useful")
    cost_tier: Optional[StrictStr] = Field(default='moderate', description="Relative cost tier: cheap, moderate, expensive")
    requires_collections: Optional[StrictBool] = Field(default=True, description="Whether this stage requires collection access")
    __properties: ClassVar[List[str]] = ["stage_id", "description", "category", "icon", "parameter_schema", "example_config", "common_use_cases", "cost_tier", "requires_collections"]

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

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

        _obj = cls.model_validate({
            "stage_id": obj.get("stage_id"),
            "description": obj.get("description"),
            "category": obj.get("category"),
            "icon": obj.get("icon"),
            "parameter_schema": obj.get("parameter_schema"),
            "example_config": obj.get("example_config"),
            "common_use_cases": obj.get("common_use_cases"),
            "cost_tier": obj.get("cost_tier") if obj.get("cost_tier") is not None else 'moderate',
            "requires_collections": obj.get("requires_collections") if obj.get("requires_collections") is not None else True
        })
        return _obj


