# generated by datamodel-codegen:
#   filename:  push-notification-config.json
#   timestamp: 2025-11-15T22:03:55+00:00

from __future__ import annotations

from enum import Enum
from typing import Annotated

from adcp.types.base import AdCPBaseModel
from pydantic import AnyUrl, ConfigDict, Field


class Scheme(Enum):
    Bearer = "Bearer"
    HMAC_SHA256 = "HMAC-SHA256"


class Authentication(AdCPBaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    credentials: Annotated[
        str,
        Field(
            description="Credentials for authentication. For Bearer: token sent in Authorization header. For HMAC-SHA256: shared secret used to generate signature. Minimum 32 characters. Exchanged out-of-band during onboarding.",
            min_length=32,
        ),
    ]
    schemes: Annotated[
        list[Scheme],
        Field(
            description="Array of authentication schemes. Supported: ['Bearer'] for simple token auth, ['HMAC-SHA256'] for signature verification (recommended for production)",
            max_length=1,
            min_length=1,
        ),
    ]


class PushNotificationConfig(AdCPBaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    authentication: Annotated[
        Authentication,
        Field(description="Authentication configuration for webhook delivery (A2A-compatible)"),
    ]
    token: Annotated[
        str | None,
        Field(
            description="Optional client-provided token for webhook validation. Echoed back in webhook payload to validate request authenticity.",
            min_length=16,
        ),
    ] = None
    url: Annotated[AnyUrl, Field(description="Webhook endpoint URL for task status notifications")]
