from enum import Enum
from typing import Dict, Any, List, Optional
from pydantic import BaseModel, Field


class PlatformType(str, Enum):
    BOSS = "boss"
    QCWY = "qcwy"
    ZHILIAN = "zhilian"


class ChannelType(str, Enum):
    MINI = "mini"
    WEB = "web"
    APP = "app"
    COMPANY = "company"  # 公司关联职位（与搜索职位 mini 区分）


class DataType(str, Enum):
    JOB = "job"
    COMPANY = "company"


class IngestSingleRequest(BaseModel):
    data: Dict[str, Any] = Field(..., description="要存储的数据")
    data_type: DataType = Field(..., description="数据类型")
    platform: PlatformType = Field(..., description="平台类型")
    channel: ChannelType = Field(ChannelType.MINI, description="渠道类型")
    check_duplicate: bool = Field(True, description="是否检查重复")


class IngestBatchRequest(BaseModel):
    data_list: List[Dict[str, Any]] = Field(..., description="要存储的数据列表")
    data_type: DataType = Field(..., description="数据类型")
    platform: PlatformType = Field(..., description="平台类型")
    channel: ChannelType = Field(ChannelType.MINI, description="渠道类型")
    check_duplicate: bool = Field(True, description="是否检查重复")


class IngestResponse(BaseModel):
    code: int = 200
    message: str = "ok"
    data: Optional[Dict[str, Any]] = None
