# -*- coding: utf-8 -*-
"""
租户管理后台 — 维客线索管理 Pydantic Schema。

覆盖：客户搜索结果、线索列表、线索编辑、线索隐藏/显示。

需求: 9.1, 10.1, 11.1
"""

from __future__ import annotations

from enum import Enum
from typing import Optional

from pydantic import Field, field_validator

from app.schemas.base import CamelModel


class ClueCategory(str, Enum):
    """线索大类枚举（6 值）。"""
    CUSTOMER_BASIC = "客户基础"
    CONSUMPTION_HABIT = "消费习惯"
    PLAY_PREFERENCE = "玩法偏好"
    PROMO_PREFERENCE = "促销偏好"
    SOCIAL_RELATION = "社交关系"
    IMPORTANT_FEEDBACK = "重要反馈"


class CustomerSearchItem(CamelModel):
    """客户搜索结果项。"""
    member_id: int
    nickname: str | None = None
    mobile_masked: str | None = None
    site_name: str | None = None
    site_id: int | None = None


class ClueListItem(CamelModel):
    """线索列表项。"""
    id: int
    category: str | None = None
    summary: str | None = None
    detail: str | None = None
    recorded_by_name: str | None = None
    source: str | None = None
    recorded_at: str | None = None
    is_hidden: bool = False


class ClueEditRequest(CamelModel):
    """线索编辑请求。"""
    category: ClueCategory = Field(..., description="线索大类（6 值枚举）")
    summary: str = Field(..., min_length=1, max_length=200, description="摘要（非空，≤200 字符）")
    detail: Optional[str] = Field(None, description="详情（可选）")


class ClueVisibilityRequest(CamelModel):
    """线索隐藏/显示请求。"""
    is_hidden: bool = Field(..., description="是否隐藏")
