"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from acuvity.types import BaseModel
from datetime import datetime
from enum import Enum
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class Kind(str, Enum):
    r"""The kind of the span."""

    UNSPECIFIED = "Unspecified"
    INTERNAL = "Internal"
    SERVER = "Server"
    CLIENT = "Client"
    PRODUCER = "Producer"
    CONSUMER = "Consumer"


class StatusCode(str, Enum):
    r"""Status Code of a span."""

    UNSET = "Unset"
    OK = "OK"
    ERROR = "Error"


class TracerefTypedDict(TypedDict):
    r"""Holds all references to a trace which are also the essentials of the span data."""

    span_end: datetime
    r"""When the span ended."""
    span_id: str
    r"""The span ID that is being referenced."""
    span_name: str
    r"""The name of the span that is being collected."""
    span_start: datetime
    r"""When the span started."""
    trace_id: str
    r"""The Trace ID that is being referenced as hex encoded string."""
    kind: NotRequired[Kind]
    r"""The kind of the span."""
    parent_span_id: NotRequired[str]
    r"""The parent span ID that is being referenced as hex encoded string."""
    status_code: NotRequired[StatusCode]
    r"""Status Code of a span."""
    status_message: NotRequired[str]
    r"""A developer-facing human readable error message."""
    transparent_span_id: NotRequired[str]
    r"""The transparent span ID that is being referenced. If the application operates in
    transparent tracing mode, then this field must be set to the span ID that this
    span is originally referencing.
    """


class Traceref(BaseModel):
    r"""Holds all references to a trace which are also the essentials of the span data."""

    span_end: Annotated[datetime, pydantic.Field(alias="spanEnd")]
    r"""When the span ended."""

    span_id: Annotated[str, pydantic.Field(alias="spanID")]
    r"""The span ID that is being referenced."""

    span_name: Annotated[str, pydantic.Field(alias="spanName")]
    r"""The name of the span that is being collected."""

    span_start: Annotated[datetime, pydantic.Field(alias="spanStart")]
    r"""When the span started."""

    trace_id: Annotated[str, pydantic.Field(alias="traceID")]
    r"""The Trace ID that is being referenced as hex encoded string."""

    kind: Optional[Kind] = Kind.UNSPECIFIED
    r"""The kind of the span."""

    parent_span_id: Annotated[Optional[str], pydantic.Field(alias="parentSpanID")] = (
        None
    )
    r"""The parent span ID that is being referenced as hex encoded string."""

    status_code: Annotated[Optional[StatusCode], pydantic.Field(alias="statusCode")] = (
        StatusCode.UNSET
    )
    r"""Status Code of a span."""

    status_message: Annotated[Optional[str], pydantic.Field(alias="statusMessage")] = (
        None
    )
    r"""A developer-facing human readable error message."""

    transparent_span_id: Annotated[
        Optional[str], pydantic.Field(alias="transparentSpanID")
    ] = None
    r"""The transparent span ID that is being referenced. If the application operates in
    transparent tracing mode, then this field must be set to the span ID that this
    span is originally referencing.
    """
