# 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: 1.3.0
    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
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from typing import Optional, Set
from typing_extensions import Self

class BaseRateLimits(BaseModel):
    """
    Rate limits by operation type (requests per minute).  The rate limiting system uses 5 categories aligned with actual resource consumption:  Categories:     metadata: Infrastructure and configuration operations (namespaces, collections,              retrievers, taxonomies, clusters CRUD). Zero-credit operations with              highest rate limits.      data: Data operations (objects, documents CRUD). Low-credit operations with           high rate limits.      search: Search and retrieval operations (retriever/taxonomy execution).             Medium-credit operations with moderate rate limits.      upload: File upload operations (credit-intensive: 1 credit/MB). Variable-credit             operations with lower rate limits.      compute: Compute operations (cluster execution, batch processing). High-credit              operations (10 credits/min video) with lowest rate limits.  Rate Limit Strategy:     Higher limits for low-cost operations (metadata, data)     Lower limits for high-cost operations (upload, compute)     This aligns API throttling with actual infrastructure costs  Examples:     - Creating a namespace: Uses 'metadata' category (fast, cheap)     - Uploading a file: Uses 'upload' category (slow, expensive per MB)     - Executing a retriever: Uses 'search' category (moderate cost)     - Running batch processing: Uses 'compute' category (very expensive)
    """ # noqa: E501
    metadata: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=10, description="REQUIRED. Rate limit for infrastructure and configuration operations (namespaces, collections, retrievers, taxonomies, clusters CRUD). These are zero-credit operations with highest rate limits since they're cheap to execute. Examples: creating collections, updating retrievers, listing namespaces.")
    data: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=10, description="REQUIRED. Rate limit for data operations (objects, documents CRUD). Low-credit operations with high rate limits. Examples: creating documents, updating objects, batch document updates.")
    search: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=10, description="REQUIRED. Rate limit for search and retrieval operations (retriever/taxonomy execution). Medium-credit operations with moderate rate limits. Examples: executing retrievers, running taxonomy matching.")
    upload: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=10, description="REQUIRED. Rate limit for file upload operations. Credit-intensive (1 credit/MB) with lower rate limits to prevent excessive resource consumption. Examples: uploading files, generating presigned URLs.")
    compute: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=10, description="REQUIRED. Rate limit for compute operations (cluster execution, batch processing). High-credit operations (10 credits/min video) with lowest rate limits. Examples: submitting batches, executing clusters, triggering syncs.")
    __properties: ClassVar[List[str]] = ["metadata", "data", "search", "upload", "compute"]

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

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

        _obj = cls.model_validate({
            "metadata": obj.get("metadata") if obj.get("metadata") is not None else 10,
            "data": obj.get("data") if obj.get("data") is not None else 10,
            "search": obj.get("search") if obj.get("search") is not None else 10,
            "upload": obj.get("upload") if obj.get("upload") is not None else 10,
            "compute": obj.get("compute") if obj.get("compute") is not None else 10
        })
        return _obj


