# 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, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from mixpeek.models.compute_tier import ComputeTier
from typing import Optional, Set
from typing_extensions import Self

class OrganizationInfrastructure(BaseModel):
    """
    Infrastructure configuration for an organization.  Defines dedicated infrastructure resources for ENTERPRISE tier organizations. When configured, all namespaces in the organization inherit these settings unless explicitly overridden at the namespace level.  Multi-Tenant Architecture:     SHARED (FREE/PRO tiers):         - Uses Mixpeek's shared Qdrant instance (settings.QDRANT_URL)         - Uses Mixpeek's shared Ray cluster (settings.RAY_ADDRESS)         - infrastructure field is None or not configured      DEDICATED (ENTERPRISE tier):         - Uses organization's dedicated Qdrant instance         - Uses organization's dedicated Ray cluster         - infrastructure field is configured with dedicated endpoints  Namespace Override:     Individual namespaces can override organization defaults by configuring     their own infrastructure settings in NamespaceInfrastructure.  Examples:     - FREE/PRO org: infrastructure=None (uses shared)     - ENTERPRISE org: infrastructure configured with dedicated URLs     - ENTERPRISE org namespace override: namespace.infrastructure overrides org.infrastructure
    """ # noqa: E501
    qdrant_url: Optional[StrictStr] = Field(default=None, description="Dedicated Qdrant instance URL for this organization. When set, all requests from this organization route to this Qdrant instance. Format: http://hostname:port or https://hostname:port. REQUIRED for ENTERPRISE tier with dedicated infrastructure. NOT REQUIRED for SHARED tier (uses settings.QDRANT_URL).")
    qdrant_api_key: Optional[StrictStr] = Field(default=None, description="API key for dedicated Qdrant instance. REQUIRED when qdrant_url is set. NOT REQUIRED for shared tier.")
    ray_head_node_url: Optional[StrictStr] = Field(default=None, description="Dedicated Ray cluster head node URL for job submission. Format: ray://hostname:port. REQUIRED for ENTERPRISE tier with dedicated Ray cluster. NOT REQUIRED for SHARED tier (uses settings.RAY_ADDRESS).")
    ray_dashboard_url: Optional[StrictStr] = Field(default=None, description="Ray dashboard URL for monitoring and job submission. Format: http://hostname:port. REQUIRED for ENTERPRISE tier with dedicated Ray cluster. NOT REQUIRED for SHARED tier.")
    compute_tier: Optional[ComputeTier] = Field(default=None, description="Default compute tier for all namespaces in this organization. Individual namespaces can override this setting. SHARED: Multi-tenant Mixpeek infrastructure. DEDICATED_CPU: Single-tenant CPU compute. DEDICATED_GPU: Single-tenant GPU compute.")
    __properties: ClassVar[List[str]] = ["qdrant_url", "qdrant_api_key", "ray_head_node_url", "ray_dashboard_url", "compute_tier"]

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

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

        _obj = cls.model_validate({
            "qdrant_url": obj.get("qdrant_url"),
            "qdrant_api_key": obj.get("qdrant_api_key"),
            "ray_head_node_url": obj.get("ray_head_node_url"),
            "ray_dashboard_url": obj.get("ray_dashboard_url"),
            "compute_tier": obj.get("compute_tier")
        })
        return _obj


