"""admin 反馈工单 schemas。"""
from __future__ import annotations

from datetime import datetime

from pydantic import BaseModel, ConfigDict, Field

from app.core.rewards import FEEDBACK_REWARD_MAX_COINS


class FeedbackOut(BaseModel):
    model_config = ConfigDict(from_attributes=True)

    id: int
    user_id: int
    content: str
    contact: str
    images: list[str] | None = None
    status: str
    reject_reason: str | None = None
    reward_coins: int | None = None
    review_note: str | None = None
    reviewed_by_admin_id: int | None = None
    reviewed_at: datetime | None = None
    created_at: datetime


class FeedbackApproveRequest(BaseModel):
    reward_coins: int = Field(
        ge=1,
        le=FEEDBACK_REWARD_MAX_COINS,
        description="采纳后发放金币数",
    )
    note: str | None = Field(default=None, max_length=256, description="采纳要点/审核备注")


class FeedbackRejectRequest(BaseModel):
    reason: str = Field(min_length=1, max_length=256, description="未采纳原因,用户端可见")
    note: str | None = Field(default=None, max_length=256, description="运营内部审核备注")
