# coding: utf-8

"""
    Endpoint Agents API

    **Note:** The Endpoint Agents Transfer APIs are not available for ThousandEyes for Government instance.  Manage ThousandEyes Endpoint Agents using this API.   For more information about Endpoint Agents, see [Endpoint Agents](https://docs.thousandeyes.com/product-documentation/global-vantage-points/endpoint-agents).

    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 typing_extensions import Annotated
from thousandeyes_sdk.endpoint_agents.models.agent_license_type import AgentLicenseType
from thousandeyes_sdk.endpoint_agents.models.platform import Platform
from typing import Optional, Set
from typing_extensions import Self

class AgentSearchFilters(BaseModel):
    """
    AgentSearchFilters
    """ # noqa: E501
    id: Optional[List[StrictStr]] = Field(default=None, description="Returns only agents that are an exact match of the provided identifiers.")
    agent_name: Optional[List[StrictStr]] = Field(default=None, description="Returns only agents with the given name.  This is an exact match only. ", alias="agentName")
    computer_name: Optional[List[StrictStr]] = Field(default=None, description="Returns only agents with the given computer name. This is an exact match only. ", alias="computerName")
    username: Optional[List[StrictStr]] = Field(default=None, description="Returns only agents that have at least one user with a name. starting with the provided string. This is a case-insensitive prefix match. ")
    user_principal_name: Optional[List[StrictStr]] = Field(default=None, description="Returns only agents that have at least one user principal name, starting with one of the provided strings. This is a case-insensitive prefix match. User principle name is the user login name in an Internet-style format, typically used in Active Directory environments. ", alias="userPrincipalName")
    platform: Optional[List[Platform]] = Field(default=None, description="Filter on the platform on which the agent is running. ")
    os_version: Optional[List[StrictStr]] = Field(default=None, description="Case-insensitive prefix filter on the OS version.", alias="osVersion")
    serial_number: Optional[Annotated[List[StrictStr], Field(max_length=50)]] = Field(default=None, description="Case-insensitive prefix filter on the serial number.", alias="serialNumber")
    location_country_iso: Optional[List[StrictStr]] = Field(default=None, description="Filter using the ISO country code of the location. ", alias="locationCountryISO")
    location_subdivision1_code: Optional[List[StrictStr]] = Field(default=None, description="Filter using the code for the first level administrative division within  the country. In US/Canada this is the State, in UK it's the country e.g. `ENG` ", alias="locationSubdivision1Code")
    location_city: Optional[List[StrictStr]] = Field(default=None, description="This is a prefix match on the city name field. The endpoint expects this to contain the  name of the city in English. e.g. 'Paris' or '' ", alias="locationCity")
    license_type: Optional[List[AgentLicenseType]] = Field(default=None, description="Filter on the agent's license type ", alias="licenseType")
    any_connect_device_id: Optional[List[StrictStr]] = Field(default=None, description="IDs of devices that has the Cisco Secure Client deployed with the Internet Security module. Returns only agents that have at least one matching `anyConnectDeviceId`. ", alias="anyConnectDeviceId")
    __properties: ClassVar[List[str]] = ["id", "agentName", "computerName", "username", "userPrincipalName", "platform", "osVersion", "serialNumber", "locationCountryISO", "locationSubdivision1Code", "locationCity", "licenseType", "anyConnectDeviceId"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
        extra="allow",
    )


    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 self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True)

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of AgentSearchFilters 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 AgentSearchFilters from a dict"""
        if obj is None:
            return None

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

        _obj = cls.model_validate({
            "id": obj.get("id"),
            "agentName": obj.get("agentName"),
            "computerName": obj.get("computerName"),
            "username": obj.get("username"),
            "userPrincipalName": obj.get("userPrincipalName"),
            "platform": obj.get("platform"),
            "osVersion": obj.get("osVersion"),
            "serialNumber": obj.get("serialNumber"),
            "locationCountryISO": obj.get("locationCountryISO"),
            "locationSubdivision1Code": obj.get("locationSubdivision1Code"),
            "locationCity": obj.get("locationCity"),
            "licenseType": obj.get("licenseType"),
            "anyConnectDeviceId": obj.get("anyConnectDeviceId")
        })
        return _obj


