# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional

from ...._models import BaseModel
from .fallback_domain import FallbackDomain
from .split_tunnel_exclude import SplitTunnelExclude
from .split_tunnel_include import SplitTunnelInclude

__all__ = ["SettingsPolicy", "DNSSearchSuffix", "GlobalAcceleration", "ServiceModeV2", "TargetTest", "VirtualNetworks"]


class DNSSearchSuffix(BaseModel):
    suffix: str
    """The DNS search suffix to append when resolving short hostnames."""

    description: Optional[str] = None
    """A description of the DNS search suffix."""


class GlobalAcceleration(BaseModel):
    """Global Acceleration settings for China.

    When configured, WARP clients connect to the Global Accelerator addresses instead of the default ones. Please contact your account representative to enable this feature on your account. See https://developers.cloudflare.com/china-network/concepts/global-acceleration/.
    """

    api_endpoints: List[str]
    """IP:port entries for the API endpoints."""

    enabled: bool
    """Global acceleration settings are used only when "enabled"."""

    masque_endpoints: List[str]
    """IP:port entries for the MASQUE tunnel endpoints.

    Either wireguard_endpoints or masque_endpoints must be provided.
    """

    wireguard_endpoints: List[str]
    """IP:port entries for the WireGuard tunnel endpoints.

    Either wireguard_endpoints or masque_endpoints must be provided.
    """


class ServiceModeV2(BaseModel):
    mode: Optional[str] = None
    """The mode to run the WARP client under."""

    port: Optional[float] = None
    """The port number when used with proxy mode."""


class TargetTest(BaseModel):
    id: Optional[str] = None
    """The id of the DEX test targeting this policy."""

    name: Optional[str] = None
    """The name of the DEX test targeting this policy."""


class VirtualNetworks(BaseModel):
    """Virtual network access settings for the device."""

    allowed: List[str]
    """List of virtual network IDs the device is allowed to access.

    When virtual_networks is set, at least one entry is required.
    """

    default: str
    """The default virtual network ID. Must be included in the `allowed` list."""


class SettingsPolicy(BaseModel):
    allow_mode_switch: Optional[bool] = None
    """Whether to allow the user to switch WARP between modes."""

    allow_updates: Optional[bool] = None
    """
    Whether to receive update notifications when a new version of the client is
    available.
    """

    allowed_to_leave: Optional[bool] = None
    """Whether to allow devices to leave the organization."""

    auto_connect: Optional[float] = None
    """The amount of time in seconds to reconnect after having been disabled."""

    captive_portal: Optional[float] = None
    """Turn on the captive portal after the specified amount of time."""

    default: Optional[bool] = None
    """Whether the policy is the default policy for an account."""

    description: Optional[str] = None
    """A description of the policy."""

    disable_auto_fallback: Optional[bool] = None
    """
    If the `dns_server` field of a fallback domain is not present, the client will
    fall back to a best guess of the default/system DNS resolvers unless this policy
    option is set to `true`.
    """

    dns_search_suffixes: Optional[List[DNSSearchSuffix]] = None
    """List of DNS search suffixes to apply to clients.

    Suffixes are evaluated in order. Use an empty array to clear.
    """

    enabled: Optional[bool] = None
    """Whether the policy will be applied to matching devices."""

    exclude: Optional[List[SplitTunnelExclude]] = None
    """List of routes excluded in the WARP client's tunnel."""

    exclude_office_ips: Optional[bool] = None
    """Whether to add Microsoft IPs to Split Tunnel exclusions."""

    fallback_domains: Optional[List[FallbackDomain]] = None

    gateway_unique_id: Optional[str] = None

    global_acceleration: Optional[GlobalAcceleration] = None
    """Global Acceleration settings for China.

    When configured, WARP clients connect to the Global Accelerator addresses
    instead of the default ones. Please contact your account representative to
    enable this feature on your account. See
    https://developers.cloudflare.com/china-network/concepts/global-acceleration/.
    """

    include: Optional[List[SplitTunnelInclude]] = None
    """List of routes included in the WARP client's tunnel."""

    lan_allow_minutes: Optional[float] = None
    """The amount of time in minutes a user is allowed access to their LAN.

    A value of 0 will allow LAN access until the next WARP reconnection, such as a
    reboot or a laptop waking from sleep. Note that this field is omitted from the
    response if null or unset.
    """

    lan_allow_subnet_size: Optional[float] = None
    """The size of the subnet for the local access network.

    Note that this field is omitted from the response if null or unset.
    """

    match: Optional[str] = None
    """The wirefilter expression to match devices.

    Available values: "identity.email", "identity.groups.id",
    "identity.groups.name", "identity.groups.email", "identity.service_token_uuid",
    "identity.saml_attributes", "network", "os.name", "os.version".
    """

    name: Optional[str] = None
    """The name of the device settings profile."""

    policy_id: Optional[str] = None

    precedence: Optional[float] = None
    """The precedence of the policy.

    Lower values indicate higher precedence. Policies will be evaluated in ascending
    order of this field.
    """

    register_interface_ip_with_dns: Optional[bool] = None
    """
    Determines if the operating system will register WARP's local interface IP with
    your on-premises DNS server.
    """

    sccm_vpn_boundary_support: Optional[bool] = None
    """
    Determines whether the WARP client indicates to SCCM that it is inside a VPN
    boundary. (Windows only).
    """

    service_mode_v2: Optional[ServiceModeV2] = None

    support_url: Optional[str] = None
    """The URL to launch when the Send Feedback button is clicked."""

    switch_locked: Optional[bool] = None
    """
    Whether to allow the user to turn off the WARP switch and disconnect the client.
    """

    target_tests: Optional[List[TargetTest]] = None

    tunnel_protocol: Optional[str] = None
    """Determines which tunnel protocol to use."""

    virtual_networks: Optional[VirtualNetworks] = None
    """Virtual network access settings for the device."""
