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

from __future__ import annotations

from typing import List, Union, Iterable, Optional
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict

from ...._types import SequenceNotStr
from ...._utils import PropertyInfo
from ..migration_step_param import MigrationStepParam
from .consumer_script_param import ConsumerScriptParam
from ..single_step_migration_param import SingleStepMigrationParam

__all__ = [
    "ScriptAndVersionSettingEditParams",
    "Settings",
    "SettingsAnnotations",
    "SettingsBinding",
    "SettingsBindingWorkersBindingKindAI",
    "SettingsBindingWorkersBindingKindAISearch",
    "SettingsBindingWorkersBindingKindAISearchNamespace",
    "SettingsBindingWorkersBindingKindAnalyticsEngine",
    "SettingsBindingWorkersBindingKindAssets",
    "SettingsBindingWorkersBindingKindBrowser",
    "SettingsBindingWorkersBindingKindD1",
    "SettingsBindingWorkersBindingKindDataBlob",
    "SettingsBindingWorkersBindingKindDispatchNamespace",
    "SettingsBindingWorkersBindingKindDispatchNamespaceOutbound",
    "SettingsBindingWorkersBindingKindDispatchNamespaceOutboundParam",
    "SettingsBindingWorkersBindingKindDispatchNamespaceOutboundWorker",
    "SettingsBindingWorkersBindingKindDurableObjectNamespace",
    "SettingsBindingWorkersBindingKindHyperdrive",
    "SettingsBindingWorkersBindingKindInherit",
    "SettingsBindingWorkersBindingKindImages",
    "SettingsBindingWorkersBindingKindJson",
    "SettingsBindingWorkersBindingKindKVNamespace",
    "SettingsBindingWorkersBindingKindMedia",
    "SettingsBindingWorkersBindingKindMTLSCertificate",
    "SettingsBindingWorkersBindingKindPlainText",
    "SettingsBindingWorkersBindingKindPipelines",
    "SettingsBindingWorkersBindingKindQueue",
    "SettingsBindingWorkersBindingKindRatelimit",
    "SettingsBindingWorkersBindingKindRatelimitSimple",
    "SettingsBindingWorkersBindingKindR2Bucket",
    "SettingsBindingWorkersBindingKindSecretText",
    "SettingsBindingWorkersBindingKindSendEmail",
    "SettingsBindingWorkersBindingKindService",
    "SettingsBindingWorkersBindingKindTextBlob",
    "SettingsBindingWorkersBindingKindVectorize",
    "SettingsBindingWorkersBindingKindVersionMetadata",
    "SettingsBindingWorkersBindingKindSecretsStoreSecret",
    "SettingsBindingWorkersBindingKindFlagship",
    "SettingsBindingWorkersBindingKindSecretKey",
    "SettingsBindingWorkersBindingKindWorkflow",
    "SettingsBindingWorkersBindingKindWasmModule",
    "SettingsBindingWorkersBindingKindVPCService",
    "SettingsBindingWorkersBindingKindVPCNetwork",
    "SettingsLimits",
    "SettingsMigrations",
    "SettingsMigrationsWorkersMultipleStepMigrations",
    "SettingsObservability",
    "SettingsObservabilityLogs",
    "SettingsObservabilityTraces",
    "SettingsPlacement",
    "SettingsPlacementMode",
    "SettingsPlacementRegion",
    "SettingsPlacementHostname",
    "SettingsPlacementHost",
    "SettingsPlacementUnionMember4",
    "SettingsPlacementUnionMember5",
    "SettingsPlacementUnionMember6",
    "SettingsPlacementUnionMember7",
    "SettingsPlacementUnionMember7Target",
    "SettingsPlacementUnionMember7TargetRegion",
    "SettingsPlacementUnionMember7TargetHostname",
    "SettingsPlacementUnionMember7TargetHost",
]


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

    settings: Settings


class SettingsAnnotations(TypedDict, total=False):
    """Annotations for the Worker version.

    Annotations are not inherited across settings updates; omitting this field means the new version will have no annotations.
    """

    workers_message: Annotated[str, PropertyInfo(alias="workers/message")]
    """Human-readable message about the version. Truncated to 1000 bytes if longer."""

    workers_tag: Annotated[str, PropertyInfo(alias="workers/tag")]
    """User-provided identifier for the version. Maximum 100 bytes."""


class SettingsBindingWorkersBindingKindAI(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["ai"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindAISearch(TypedDict, total=False):
    instance_name: Required[str]
    """The user-chosen instance name.

    Must exist at deploy time. The worker can search, chat, update, and manage
    items/jobs on this instance.
    """

    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["ai_search"]]
    """The kind of resource that the binding provides."""

    namespace: str
    """The namespace the instance belongs to.

    Defaults to "default" if omitted. Customers who don't use namespaces can simply
    omit this field.
    """


class SettingsBindingWorkersBindingKindAISearchNamespace(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    namespace: Required[str]
    """The user-chosen namespace name.

    Must exist before deploy -- Wrangler handles auto-creation on deploy failure (R2
    bucket pattern). The "default" namespace is auto-created by config-api for new
    accounts. Grants full access (CRUD + search + chat) to all instances within the
    namespace.
    """

    type: Required[Literal["ai_search_namespace"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindAnalyticsEngine(TypedDict, total=False):
    dataset: Required[str]
    """The name of the dataset to bind to."""

    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["analytics_engine"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindAssets(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["assets"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindBrowser(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["browser"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindD1(TypedDict, total=False):
    database_id: Required[str]
    """Identifier of the D1 database to bind to."""

    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["d1"]]
    """The kind of resource that the binding provides."""

    id: str
    """Identifier of the D1 database to bind to."""


class SettingsBindingWorkersBindingKindDataBlob(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    part: Required[str]
    """The name of the file containing the data content.

    Only accepted for `service worker syntax` Workers.
    """

    type: Required[Literal["data_blob"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindDispatchNamespaceOutboundParam(TypedDict, total=False):
    name: Required[str]
    """Name of the parameter."""


class SettingsBindingWorkersBindingKindDispatchNamespaceOutboundWorker(TypedDict, total=False):
    """Outbound worker."""

    entrypoint: str
    """Entrypoint to invoke on the outbound worker."""

    environment: str
    """Environment of the outbound worker."""

    service: str
    """Name of the outbound worker."""


class SettingsBindingWorkersBindingKindDispatchNamespaceOutbound(TypedDict, total=False):
    """Outbound worker."""

    params: Iterable[SettingsBindingWorkersBindingKindDispatchNamespaceOutboundParam]
    """
    Pass information from the Dispatch Worker to the Outbound Worker through the
    parameters.
    """

    worker: SettingsBindingWorkersBindingKindDispatchNamespaceOutboundWorker
    """Outbound worker."""


class SettingsBindingWorkersBindingKindDispatchNamespace(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    namespace: Required[str]
    """The name of the dispatch namespace."""

    type: Required[Literal["dispatch_namespace"]]
    """The kind of resource that the binding provides."""

    outbound: SettingsBindingWorkersBindingKindDispatchNamespaceOutbound
    """Outbound worker."""


class SettingsBindingWorkersBindingKindDurableObjectNamespace(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["durable_object_namespace"]]
    """The kind of resource that the binding provides."""

    class_name: str
    """The exported class name of the Durable Object."""

    dispatch_namespace: str
    """The dispatch namespace the Durable Object script belongs to."""

    environment: str
    """The environment of the script_name to bind to."""

    namespace_id: str
    """Namespace identifier tag."""

    script_name: str
    """
    The script where the Durable Object is defined, if it is external to this
    Worker.
    """


class SettingsBindingWorkersBindingKindHyperdrive(TypedDict, total=False):
    id: Required[str]
    """Identifier of the Hyperdrive connection to bind to."""

    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["hyperdrive"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindInherit(TypedDict, total=False):
    name: Required[str]
    """The name of the inherited binding."""

    type: Required[Literal["inherit"]]
    """The kind of resource that the binding provides."""

    old_name: str
    """The old name of the inherited binding.

    If set, the binding will be renamed from `old_name` to `name` in the new
    version. If not set, the binding will keep the same name between versions.
    """

    version_id: str
    """
    Identifier for the version to inherit the binding from, which can be the version
    ID or the literal "latest" to inherit from the latest version. Defaults to
    inheriting the binding from the latest version.
    """


class SettingsBindingWorkersBindingKindImages(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["images"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindJson(TypedDict, total=False):
    json: Required[object]
    """JSON data to use."""

    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["json"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindKVNamespace(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    namespace_id: Required[str]
    """Namespace identifier tag."""

    type: Required[Literal["kv_namespace"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindMedia(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["media"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindMTLSCertificate(TypedDict, total=False):
    certificate_id: Required[str]
    """Identifier of the certificate to bind to."""

    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["mtls_certificate"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindPlainText(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    text: Required[str]
    """The text value to use."""

    type: Required[Literal["plain_text"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindPipelines(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    pipeline: Required[str]
    """Name of the Pipeline to bind to."""

    type: Required[Literal["pipelines"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindQueue(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    queue_name: Required[str]
    """Name of the Queue to bind to."""

    type: Required[Literal["queue"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindRatelimitSimple(TypedDict, total=False):
    """The rate limit configuration."""

    limit: Required[float]
    """The limit (requests per period)."""

    period: Required[int]
    """The period in seconds."""

    mitigation_timeout: int
    """
    Duration in seconds to apply the mitigation action after the rate limit is
    exceeded. Valid values are 0 (disabled), 10, or multiples of 60 up to 86400.
    Must be greater than or equal to the period when non-zero.
    """


class SettingsBindingWorkersBindingKindRatelimit(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    namespace_id: Required[str]
    """Identifier of the rate limit namespace to bind to."""

    simple: Required[SettingsBindingWorkersBindingKindRatelimitSimple]
    """The rate limit configuration."""

    type: Required[Literal["ratelimit"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindR2Bucket(TypedDict, total=False):
    bucket_name: Required[str]
    """R2 bucket to bind to."""

    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["r2_bucket"]]
    """The kind of resource that the binding provides."""

    jurisdiction: Literal["eu", "fedramp", "fedramp-high"]
    """
    The
    [jurisdiction](https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions)
    of the R2 bucket.
    """


class SettingsBindingWorkersBindingKindSecretText(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    text: Required[str]
    """The secret value to use."""

    type: Required[Literal["secret_text"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindSendEmail(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["send_email"]]
    """The kind of resource that the binding provides."""

    allowed_destination_addresses: SequenceNotStr[str]
    """List of allowed destination addresses."""

    allowed_sender_addresses: SequenceNotStr[str]
    """List of allowed sender addresses."""

    destination_address: str
    """Destination address for the email."""


class SettingsBindingWorkersBindingKindService(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    service: Required[str]
    """Name of Worker to bind to."""

    type: Required[Literal["service"]]
    """The kind of resource that the binding provides."""

    entrypoint: str
    """Entrypoint to invoke on the target Worker."""

    environment: str
    """Optional environment if the Worker utilizes one."""


class SettingsBindingWorkersBindingKindTextBlob(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    part: Required[str]
    """The name of the file containing the text content.

    Only accepted for `service worker syntax` Workers.
    """

    type: Required[Literal["text_blob"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindVectorize(TypedDict, total=False):
    index_name: Required[str]
    """Name of the Vectorize index to bind to."""

    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["vectorize"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindVersionMetadata(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["version_metadata"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindSecretsStoreSecret(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    secret_name: Required[str]
    """Name of the secret in the store."""

    store_id: Required[str]
    """ID of the store containing the secret."""

    type: Required[Literal["secrets_store_secret"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindFlagship(TypedDict, total=False):
    app_id: Required[str]
    """ID of the Flagship app to bind to for feature flag evaluation."""

    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["flagship"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindSecretKey(TypedDict, total=False):
    algorithm: Required[object]
    """Algorithm-specific key parameters.

    [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm).
    """

    format: Required[Literal["raw", "pkcs8", "spki", "jwk"]]
    """Data format of the key.

    [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).
    """

    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["secret_key"]]
    """The kind of resource that the binding provides."""

    usages: Required[
        List[Literal["encrypt", "decrypt", "sign", "verify", "deriveKey", "deriveBits", "wrapKey", "unwrapKey"]]
    ]
    """Allowed operations with the key.

    [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).
    """

    key_base64: str
    """Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki"."""

    key_jwk: object
    """
    Key data in
    [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key)
    format. Required if `format` is "jwk".
    """


class SettingsBindingWorkersBindingKindWorkflow(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["workflow"]]
    """The kind of resource that the binding provides."""

    workflow_name: Required[str]
    """Name of the Workflow to bind to."""

    class_name: str
    """Class name of the Workflow.

    Should only be provided if the Workflow belongs to this script.
    """

    script_name: str
    """Script name that contains the Workflow.

    If not provided, defaults to this script name.
    """


class SettingsBindingWorkersBindingKindWasmModule(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    part: Required[str]
    """The name of the file containing the WebAssembly module content.

    Only accepted for `service worker syntax` Workers.
    """

    type: Required[Literal["wasm_module"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindVPCService(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    service_id: Required[str]
    """Identifier of the VPC service to bind to."""

    type: Required[Literal["vpc_service"]]
    """The kind of resource that the binding provides."""


class SettingsBindingWorkersBindingKindVPCNetwork(TypedDict, total=False):
    name: Required[str]
    """A JavaScript variable name for the binding."""

    type: Required[Literal["vpc_network"]]
    """The kind of resource that the binding provides."""

    network_id: str
    """Identifier of the network to bind to.

    Only "cf1:network" is currently supported. Mutually exclusive with tunnel_id.
    """

    tunnel_id: str
    """UUID of the Cloudflare Tunnel to bind to. Mutually exclusive with network_id."""


SettingsBinding: TypeAlias = Union[
    SettingsBindingWorkersBindingKindAI,
    SettingsBindingWorkersBindingKindAISearch,
    SettingsBindingWorkersBindingKindAISearchNamespace,
    SettingsBindingWorkersBindingKindAnalyticsEngine,
    SettingsBindingWorkersBindingKindAssets,
    SettingsBindingWorkersBindingKindBrowser,
    SettingsBindingWorkersBindingKindD1,
    SettingsBindingWorkersBindingKindDataBlob,
    SettingsBindingWorkersBindingKindDispatchNamespace,
    SettingsBindingWorkersBindingKindDurableObjectNamespace,
    SettingsBindingWorkersBindingKindHyperdrive,
    SettingsBindingWorkersBindingKindInherit,
    SettingsBindingWorkersBindingKindImages,
    SettingsBindingWorkersBindingKindJson,
    SettingsBindingWorkersBindingKindKVNamespace,
    SettingsBindingWorkersBindingKindMedia,
    SettingsBindingWorkersBindingKindMTLSCertificate,
    SettingsBindingWorkersBindingKindPlainText,
    SettingsBindingWorkersBindingKindPipelines,
    SettingsBindingWorkersBindingKindQueue,
    SettingsBindingWorkersBindingKindRatelimit,
    SettingsBindingWorkersBindingKindR2Bucket,
    SettingsBindingWorkersBindingKindSecretText,
    SettingsBindingWorkersBindingKindSendEmail,
    SettingsBindingWorkersBindingKindService,
    SettingsBindingWorkersBindingKindTextBlob,
    SettingsBindingWorkersBindingKindVectorize,
    SettingsBindingWorkersBindingKindVersionMetadata,
    SettingsBindingWorkersBindingKindSecretsStoreSecret,
    SettingsBindingWorkersBindingKindFlagship,
    SettingsBindingWorkersBindingKindSecretKey,
    SettingsBindingWorkersBindingKindWorkflow,
    SettingsBindingWorkersBindingKindWasmModule,
    SettingsBindingWorkersBindingKindVPCService,
    SettingsBindingWorkersBindingKindVPCNetwork,
]


class SettingsLimits(TypedDict, total=False):
    """Limits to apply for this Worker."""

    cpu_ms: int
    """The amount of CPU time this Worker can use in milliseconds."""

    subrequests: int
    """The number of subrequests this Worker can make per request."""


class SettingsMigrationsWorkersMultipleStepMigrations(TypedDict, total=False):
    new_tag: str
    """Tag to set as the latest migration tag."""

    old_tag: str
    """Tag used to verify against the latest migration tag for this Worker.

    If they don't match, the upload is rejected.
    """

    steps: Iterable[MigrationStepParam]
    """Migrations to apply in order."""


SettingsMigrations: TypeAlias = Union[SingleStepMigrationParam, SettingsMigrationsWorkersMultipleStepMigrations]


class SettingsObservabilityLogs(TypedDict, total=False):
    """Log settings for the Worker."""

    enabled: Required[bool]
    """Whether logs are enabled for the Worker."""

    invocation_logs: Required[bool]
    """
    Whether
    [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs)
    are enabled for the Worker.
    """

    destinations: SequenceNotStr[str]
    """A list of destinations where logs will be exported to."""

    head_sampling_rate: Optional[float]
    """The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1."""

    persist: bool
    """Whether log persistence is enabled for the Worker."""


class SettingsObservabilityTraces(TypedDict, total=False):
    """Trace settings for the Worker."""

    destinations: SequenceNotStr[str]
    """A list of destinations where traces will be exported to."""

    enabled: bool
    """Whether traces are enabled for the Worker."""

    head_sampling_rate: Optional[float]
    """The sampling rate for traces. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1."""

    persist: bool
    """Whether trace persistence is enabled for the Worker."""


class SettingsObservability(TypedDict, total=False):
    """Observability settings for the Worker."""

    enabled: Required[bool]
    """Whether observability is enabled for the Worker."""

    head_sampling_rate: Optional[float]
    """The sampling rate for incoming requests.

    From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1.
    """

    logs: Optional[SettingsObservabilityLogs]
    """Log settings for the Worker."""

    traces: Optional[SettingsObservabilityTraces]
    """Trace settings for the Worker."""


class SettingsPlacementMode(TypedDict, total=False):
    mode: Required[Literal["smart"]]
    """
    Enables
    [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
    """


class SettingsPlacementRegion(TypedDict, total=False):
    region: Required[str]
    """Cloud region for targeted placement in format 'provider:region'."""


class SettingsPlacementHostname(TypedDict, total=False):
    hostname: Required[str]
    """HTTP hostname for targeted placement."""


class SettingsPlacementHost(TypedDict, total=False):
    host: Required[str]
    """TCP host and port for targeted placement."""


class SettingsPlacementUnionMember4(TypedDict, total=False):
    mode: Required[Literal["targeted"]]
    """Targeted placement mode."""

    region: Required[str]
    """Cloud region for targeted placement in format 'provider:region'."""


class SettingsPlacementUnionMember5(TypedDict, total=False):
    hostname: Required[str]
    """HTTP hostname for targeted placement."""

    mode: Required[Literal["targeted"]]
    """Targeted placement mode."""


class SettingsPlacementUnionMember6(TypedDict, total=False):
    host: Required[str]
    """TCP host and port for targeted placement."""

    mode: Required[Literal["targeted"]]
    """Targeted placement mode."""


class SettingsPlacementUnionMember7TargetRegion(TypedDict, total=False):
    region: Required[str]
    """Cloud region in format 'provider:region'."""


class SettingsPlacementUnionMember7TargetHostname(TypedDict, total=False):
    hostname: Required[str]
    """HTTP hostname for targeted placement."""


class SettingsPlacementUnionMember7TargetHost(TypedDict, total=False):
    host: Required[str]
    """TCP host:port for targeted placement."""


SettingsPlacementUnionMember7Target: TypeAlias = Union[
    SettingsPlacementUnionMember7TargetRegion,
    SettingsPlacementUnionMember7TargetHostname,
    SettingsPlacementUnionMember7TargetHost,
]


class SettingsPlacementUnionMember7(TypedDict, total=False):
    mode: Required[Literal["targeted"]]
    """Targeted placement mode."""

    target: Required[Iterable[SettingsPlacementUnionMember7Target]]
    """Array of placement targets (currently limited to single target)."""


SettingsPlacement: TypeAlias = Union[
    SettingsPlacementMode,
    SettingsPlacementRegion,
    SettingsPlacementHostname,
    SettingsPlacementHost,
    SettingsPlacementUnionMember4,
    SettingsPlacementUnionMember5,
    SettingsPlacementUnionMember6,
    SettingsPlacementUnionMember7,
]


class Settings(TypedDict, total=False):
    annotations: SettingsAnnotations
    """Annotations for the Worker version.

    Annotations are not inherited across settings updates; omitting this field means
    the new version will have no annotations.
    """

    bindings: Iterable[SettingsBinding]
    """List of bindings attached to a Worker.

    You can find more about bindings on our docs:
    https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.
    """

    compatibility_date: str
    """Date indicating targeted support in the Workers runtime.

    Backwards incompatible fixes to the runtime following this date will not affect
    this Worker.
    """

    compatibility_flags: SequenceNotStr[str]
    """Flags that enable or disable certain features in the Workers runtime.

    Used to enable upcoming features or opt in or out of specific changes not
    included in a `compatibility_date`.
    """

    limits: SettingsLimits
    """Limits to apply for this Worker."""

    logpush: bool
    """Whether Logpush is turned on for the Worker."""

    migrations: SettingsMigrations
    """Migrations to apply for Durable Objects associated with this Worker."""

    observability: SettingsObservability
    """Observability settings for the Worker."""

    placement: SettingsPlacement
    """
    Configuration for
    [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
    Specify mode='smart' for Smart Placement, or one of region/hostname/host.
    """

    tags: Optional[SequenceNotStr[str]]
    """Tags associated with the Worker."""

    tail_consumers: Optional[Iterable[ConsumerScriptParam]]
    """List of Workers that will consume logs from the attached Worker."""

    usage_model: Literal["standard", "bundled", "unbound"]
    """Usage model for the Worker invocations."""
