from pydantic import BaseModel, Field
from typing import Optional, List


class GetTokenRequest(BaseModel):
    """获取Token请求模型"""
    projectNo: str = Field(..., description="项目编号，格式：902000_当前时间戳")
    entityName: str = Field(..., description="项目名称")
    userId: str = Field(..., description="操作人员编号，固定值")
    userName: str = Field(..., description="操作人员姓名，固定值")
    appId: str = Field("remote_app", description="应用ID，固定值")
    appSecretCode: str = Field(..., description="安全码，md5(projectNo + '_' + entityName + '_' + dXj6eHRmPv)")
    role: str = Field("VIEWER", description="角色，固定值")
    orgCode: str = Field(..., description="行社机构号，固定值")
    entityId: Optional[str] = Field(None, description="企业统信码或个人身份证号")
    xdRelatedPersons: Optional[str] = Field(None, description="信贷关联人信息")
    jzDataDateId: Optional[str] = Field("0", description="拉取指定日期推送过来的金综链流水")
    innerBSStartDateId: Optional[str] = Field("0", description="拉取行内流水开始日期")
    innerBSEndDateId: Optional[str] = Field("0", description="拉取行内流水结束日期")
    analysisType: str = Field("-1", description="分析类型，固定值")
    departmentCode: str = Field(..., description="客户经理所属营业部/分理处的机构编码")


class FetchInnerFlowRequest(BaseModel):
    """拉取行内流水请求模型"""
    groupId: int = Field(..., description="项目id")
    customerNo: str = Field(..., description="客户身份证号")
    dataChannelCode: str = Field(..., description="校验码")
    requestDateId: int = Field(..., description="发起请求的时间")
    dataStartDateId: int = Field(..., description="拉取开始日期")
    dataEndDateId: int = Field(..., description="拉取结束日期")
    uploadUserId: int = Field(..., description="柜员号")


class CheckParseStatusRequest(BaseModel):
    """检查文件解析状态请求模型"""
    groupId: int = Field(..., description="项目id")
    inprogressList: str = Field(..., description="文件id列表，逗号分隔")


class GetBankStatementRequest(BaseModel):
    """获取银行流水请求模型"""
    groupId: int = Field(..., description="项目id")
    logId: int = Field(..., description="文件id")
    pageNow: int = Field(..., description="当前页码")
    pageSize: int = Field(..., description="查询条数")


class DeleteFilesRequest(BaseModel):
    """删除文件请求模型"""
    groupId: int = Field(..., description="项目id")
    logIds: List[int] = Field(..., description="文件id数组")
    userId: int = Field(..., description="用户柜员号")
