#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import annotations

from typing import Any

from pydantic import BaseModel, Field

from tyyp_app.config import DEFAULT_TARGET_URL, PROXY_SOURCE_URL


class ApiSubmitPhoneRequest(BaseModel):
    phone: str = Field(..., description="手机号码")
    url: str = Field(DEFAULT_TARGET_URL, description="目标页面 URL")
    proxy_api_url: str = Field(PROXY_SOURCE_URL, description="代理来源接口（返回 ip:port 文本）")


class ApiSubmitPhoneResponse(BaseModel):
    success: bool = True
    flow_id: str = Field(..., description="流程唯一标识符")
    data: Any = Field(..., description="滑块流程抓包响应体（getYanZhenMa）")
    phone: str = ""
    url: str = ""
    created_at: str = ""
    proxy: str = ""
    ua: str = ""


class ApiSubmitCodeRequest(BaseModel):
    flow_id: str = Field(..., description="submit_phone 返回的流程唯一标识符")
    code: str = Field(..., description="短信验证码")


class ApiSubmitCodeResponse(BaseModel):
    success: bool = True
    flow_id: str = ""
    data: Any = Field(..., description="验证码提交后的抓包响应体")
