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

from __future__ import annotations

from typing import Dict, Iterable
from typing_extensions import Literal, Required, TypedDict

from ..._types import SequenceNotStr
from .dcv_method import DCVMethod
from .bundle_method import BundleMethod
from ..shared.certificate_ca import CertificateCA
from .domain_validation_type import DomainValidationType

__all__ = ["CustomHostnameCreateParams", "SSL", "SSLCustomCERTBundle", "SSLSettings"]


class CustomHostnameCreateParams(TypedDict, total=False):
    zone_id: Required[str]
    """Identifier."""

    hostname: Required[str]
    """The custom hostname that will point to your hostname via CNAME."""

    custom_metadata: Dict[str, str]
    """Unique key/value metadata for this hostname.

    These are per-hostname (customer) settings.
    """

    ssl: SSL
    """SSL properties used when creating the custom hostname."""


class SSLCustomCERTBundle(TypedDict, total=False):
    custom_certificate: Required[str]
    """If a custom uploaded certificate is used."""

    custom_key: Required[str]
    """The key for a custom uploaded certificate."""


class SSLSettings(TypedDict, total=False):
    """SSL specific settings."""

    ciphers: SequenceNotStr[str]
    """An allowlist of ciphers for TLS termination.

    These ciphers must be in the BoringSSL format.
    """

    early_hints: Literal["on", "off"]
    """Whether or not Early Hints is enabled."""

    http2: Literal["on", "off"]
    """Whether or not HTTP2 is enabled."""

    min_tls_version: Literal["1.0", "1.1", "1.2", "1.3"]
    """The minimum TLS version supported."""

    tls_1_3: Literal["on", "off"]
    """Whether or not TLS 1.3 is enabled."""


class SSL(TypedDict, total=False):
    """SSL properties used when creating the custom hostname."""

    bundle_method: BundleMethod
    """
    A ubiquitous bundle has the highest probability of being verified everywhere,
    even by clients using outdated or unusual trust stores. An optimal bundle uses
    the shortest chain and newest intermediates. And the force bundle verifies the
    chain, but does not otherwise modify it.
    """

    certificate_authority: CertificateCA
    """The Certificate Authority that will issue the certificate."""

    cloudflare_branding: bool
    """Whether or not to add Cloudflare Branding for the order.

    This will add a subdomain of sni.cloudflaressl.com as the Common Name if set to
    true.
    """

    custom_cert_bundle: Iterable[SSLCustomCERTBundle]
    """Array of custom certificate and key pairs (1 or 2 pairs allowed)."""

    custom_certificate: str
    """If a custom uploaded certificate is used."""

    custom_csr_id: str
    """The identifier for the Custom CSR that was used."""

    custom_key: str
    """The key for a custom uploaded certificate."""

    method: DCVMethod
    """Domain control validation (DCV) method used for this hostname."""

    settings: SSLSettings
    """SSL specific settings."""

    type: DomainValidationType
    """Level of validation to be used for this hostname.

    Domain validation (dv) must be used.
    """

    wildcard: bool
    """Indicates whether the certificate covers a wildcard."""
