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

from __future__ import annotations

from typing import Iterable, Optional
from typing_extensions import Required, TypedDict

from ...._types import SequenceNotStr
from .consumer_script_param import ConsumerScriptParam

__all__ = ["SettingEditParams", "Observability", "ObservabilityLogs", "ObservabilityTraces"]


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

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

    observability: Optional[Observability]
    """Observability settings for the Worker."""

    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."""


class ObservabilityLogs(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 ObservabilityTraces(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 Observability(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[ObservabilityLogs]
    """Log settings for the Worker."""

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