from typing import ClassVar

from .spec import OtelGenAISpecification
from .types import (
    OPTIONAL,
    REQUIRED,
    AttributeSpec,
)


class OtelGenAIInputMessageGenericPartSpecification(OtelGenAISpecification):
    SUPPORTED_ATTRIBUTES: ClassVar[dict[str, AttributeSpec]] = {
        "type": AttributeSpec(
            name="type",
            requirement=REQUIRED,
            type="string",
        ),
    }


class OtelGenAIInputMessageTextPartSpecification(OtelGenAISpecification):
    SUPPORTED_ATTRIBUTES: ClassVar[dict[str, AttributeSpec]] = {
        "content": AttributeSpec(
            name="content",
            requirement=REQUIRED,
            type="string",
        ),
        "type": AttributeSpec(
            name="type",
            requirement=REQUIRED,
            type="string",
            valid_values=["text"],
        ),
    }


class OtelGenAIInputMessageToolCallRequestPartSpecification(OtelGenAISpecification):
    SUPPORTED_ATTRIBUTES: ClassVar[dict[str, AttributeSpec]] = {
        "arguments": AttributeSpec(
            name="arguments",
            requirement=OPTIONAL,
            type="any",
        ),
        "id": AttributeSpec(
            name="id",
            requirement=OPTIONAL,
            type="string",
        ),
        "name": AttributeSpec(
            name="name",
            requirement=REQUIRED,
            type="string",
        ),
        "type": AttributeSpec(
            name="type",
            requirement=REQUIRED,
            type="string",
            valid_values=["tool_call"],
        ),
    }


class OtelGenAIInputMessageToolCallResponsePartSpecification(OtelGenAISpecification):
    SUPPORTED_ATTRIBUTES: ClassVar[dict[str, AttributeSpec]] = {
        "id": AttributeSpec(
            name="id",
            requirement=OPTIONAL,
            type="string",
        ),
        "response": AttributeSpec(
            name="response",
            requirement=REQUIRED,
            type="any",
        ),
        "type": AttributeSpec(
            name="type",
            requirement=REQUIRED,
            type="string",
            valid_values=["tool_call_response"],
        ),
    }
