# coding: utf-8

"""
    Instana REST API documentation

    Documentation for INSTANA REST API

    The version of the OpenAPI document: 1.309.1268
    Contact: support@instana.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, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from instana_client.models.api_restricted_application_filter import ApiRestrictedApplicationFilter
from typing import Optional, Set
from typing_extensions import Self

class ApiTeamScope(BaseModel):
    """
    ApiTeamScope
    """ # noqa: E501
    access_permissions: Optional[List[StrictStr]] = Field(default=None, alias="accessPermissions")
    action_filter: Optional[StrictStr] = Field(default=None, alias="actionFilter")
    applications: Optional[List[StrictStr]] = None
    business_perspectives: Optional[List[StrictStr]] = Field(default=None, alias="businessPerspectives")
    infra_dfq_filter: Optional[StrictStr] = Field(default=None, alias="infraDfqFilter")
    kubernetes_clusters: Optional[List[StrictStr]] = Field(default=None, alias="kubernetesClusters")
    kubernetes_namespaces: Optional[List[StrictStr]] = Field(default=None, alias="kubernetesNamespaces")
    log_filter: Optional[StrictStr] = Field(default=None, alias="logFilter")
    mobile_apps: Optional[List[StrictStr]] = Field(default=None, alias="mobileApps")
    restricted_application_filter: Optional[ApiRestrictedApplicationFilter] = Field(default=None, alias="restrictedApplicationFilter")
    slo_ids: Optional[List[StrictStr]] = Field(default=None, alias="sloIds")
    synthetic_credentials: Optional[List[StrictStr]] = Field(default=None, alias="syntheticCredentials")
    synthetic_tests: Optional[List[StrictStr]] = Field(default=None, alias="syntheticTests")
    tag_ids: Optional[List[StrictStr]] = Field(default=None, alias="tagIds")
    websites: Optional[List[StrictStr]] = None
    __properties: ClassVar[List[str]] = ["accessPermissions", "actionFilter", "applications", "businessPerspectives", "infraDfqFilter", "kubernetesClusters", "kubernetesNamespaces", "logFilter", "mobileApps", "restrictedApplicationFilter", "sloIds", "syntheticCredentials", "syntheticTests", "tagIds", "websites"]

    @field_validator('access_permissions')
    def access_permissions_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        for i in value:
            if i not in set(['LIMITED_APPLICATIONS_SCOPE', 'LIMITED_WEBSITES_SCOPE', 'LIMITED_KUBERNETES_SCOPE', 'LIMITED_MOBILE_APPS_SCOPE', 'LIMITED_INFRASTRUCTURE_SCOPE', 'LIMITED_SYNTHETICS_SCOPE', 'LIMITED_BIZOPS_SCOPE', 'LIMITED_GEN_AI_SCOPE', 'LIMITED_AUTOMATION_SCOPE', 'LIMITED_LOGS_SCOPE', 'LIMITED_ALERT_CHANNELS_SCOPE', 'LIMITED_VSPHERE_SCOPE', 'LIMITED_PHMC_SCOPE', 'LIMITED_POWERVC_SCOPE', 'LIMITED_ZHMC_SCOPE', 'LIMITED_PCF_SCOPE', 'LIMITED_OPENSTACK_SCOPE', 'LIMITED_SAP_SCOPE', 'LIMITED_NUTANIX_SCOPE', 'LIMITED_XENSERVER_SCOPE', 'LIMITED_WINDOWS_HYPERVISOR_SCOPE', 'LIMITED_LINUX_KVM_HYPERVISOR_SCOPE', 'LIMITED_AI_GATEWAY_SCOPE', 'LIMITED_SERVICE_LEVEL_SCOPE']):
                raise ValueError("each list item must be one of ('LIMITED_APPLICATIONS_SCOPE', 'LIMITED_WEBSITES_SCOPE', 'LIMITED_KUBERNETES_SCOPE', 'LIMITED_MOBILE_APPS_SCOPE', 'LIMITED_INFRASTRUCTURE_SCOPE', 'LIMITED_SYNTHETICS_SCOPE', 'LIMITED_BIZOPS_SCOPE', 'LIMITED_GEN_AI_SCOPE', 'LIMITED_AUTOMATION_SCOPE', 'LIMITED_LOGS_SCOPE', 'LIMITED_ALERT_CHANNELS_SCOPE', 'LIMITED_VSPHERE_SCOPE', 'LIMITED_PHMC_SCOPE', 'LIMITED_POWERVC_SCOPE', 'LIMITED_ZHMC_SCOPE', 'LIMITED_PCF_SCOPE', 'LIMITED_OPENSTACK_SCOPE', 'LIMITED_SAP_SCOPE', 'LIMITED_NUTANIX_SCOPE', 'LIMITED_XENSERVER_SCOPE', 'LIMITED_WINDOWS_HYPERVISOR_SCOPE', 'LIMITED_LINUX_KVM_HYPERVISOR_SCOPE', 'LIMITED_AI_GATEWAY_SCOPE', 'LIMITED_SERVICE_LEVEL_SCOPE')")
        return value

    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 ApiTeamScope 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,
        )
        # override the default output from pydantic by calling `to_dict()` of restricted_application_filter
        if self.restricted_application_filter:
            _dict['restrictedApplicationFilter'] = self.restricted_application_filter.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "accessPermissions": obj.get("accessPermissions"),
            "actionFilter": obj.get("actionFilter"),
            "applications": obj.get("applications"),
            "businessPerspectives": obj.get("businessPerspectives"),
            "infraDfqFilter": obj.get("infraDfqFilter"),
            "kubernetesClusters": obj.get("kubernetesClusters"),
            "kubernetesNamespaces": obj.get("kubernetesNamespaces"),
            "logFilter": obj.get("logFilter"),
            "mobileApps": obj.get("mobileApps"),
            "restrictedApplicationFilter": ApiRestrictedApplicationFilter.from_dict(obj["restrictedApplicationFilter"]) if obj.get("restrictedApplicationFilter") is not None else None,
            "sloIds": obj.get("sloIds"),
            "syntheticCredentials": obj.get("syntheticCredentials"),
            "syntheticTests": obj.get("syntheticTests"),
            "tagIds": obj.get("tagIds"),
            "websites": obj.get("websites")
        })
        return _obj


