from pydantic import BaseModel

class TaskCreateRequest(BaseModel):
    title: str
    category: str = ""
    sub_category: str = ""
    description: str = ""
    mode: str = "grab"
    budget_min: int = 0
    budget_max: int = 0
    deadline: str = ""
    publisher_name: str = ""



class TaskStatusRequest(BaseModel):
    status: str  # review/published/completed/cancelled



class ProviderCreateRequest(BaseModel):
    name: str
    category: str = ""
    level: str = "certified"
    status: str = "pending"
    contact: str = ""



class ProviderUpdateRequest(BaseModel):
    level: str | None = None
    status: str | None = None
    contact: str | None = None



class ContentCreateRequest(BaseModel):
    type: str = "news"
    title: str
    summary: str = ""
    body: str = ""
    status: str = "draft"



class ContentStatusRequest(BaseModel):
    status: str  # published/offline/draft



class ConfigUpdateRequest(BaseModel):
    value: str
    description: str = ""


# ── 任务管理 ──────────────────────────────────────────────────────────────



# ── 算力对接（compute-engine）─────────────────────────────────────────────

# ── 培训业务四件套（课程 / 活动 / 报名 / 测评）→ 桥接 app.training ─────────

class CourseCreateRequest(BaseModel):
    title: str
    category: str = ""
    level: str = ""
    subtitle: str = ""
    desc: str = ""
    price: float = 0
    status: str = "draft"
    start_at: str = ""
    end_at: str = ""
    venue: str = ""
    quota: int = 0
    image: str = ""
    host: str = ""


class CourseStatusRequest(BaseModel):
    status: str  # draft/published/ended/offline


class ActivityStatusRequest(BaseModel):
    status: str  # open/invite/pending/done/ended


class BookingUpdateRequest(BaseModel):
    status: str | None = None
    audit_status: str | None = None
    note: str | None = None


class TestCreateRequest(BaseModel):
    title: str
    category: str = ""
    pass_score: int = 0
    question_count: int = 30


class TestStatusRequest(BaseModel):
    status: str  # enabled/disabled


class ComputePingResponse(BaseModel):
    ok: bool
    version: str | None = None
    detail: str | None = None


class ComputeProvisionRequest(BaseModel):
    user_id: str


class ComputeProvisionResponse(BaseModel):
    engine_user_id: str | None = None
    engine_username: str | None = None
    pat: str | None = None
    created: bool = False
    detail: str | None = None
