import uuid
from datetime import datetime
from pydantic import BaseModel

class LinearWebhookPayload(BaseModel):
    action: str
    data: dict


class ExceptionPayload(BaseModel):
    repo_branch: str = "main"
    fingerprint: str
    title: str
    description: str
    extra: dict = {}


class ManualTaskPayload(BaseModel):
    repo_branch: str = "main"
    prompt: str
    source_id: str


class TaskResponse(BaseModel):
    task_id: uuid.UUID
    status: str
    message: str


class CreateTokenPayload(BaseModel):
    name: str
    description: str | None = None
    metadata: dict | None = None
    expires_at: datetime | None = None


class ApiTokenResponse(BaseModel):
    id: uuid.UUID
    token: str
    name: str
    description: str | None
    metadata: dict | None
    created_at: datetime
    updated_at: datetime
    expires_at: datetime | None
    revoked_at: datetime | None
