"""SSL 相关请求模型"""

from typing import Optional

from pydantic import BaseModel, Field


class SubdomainCreate(BaseModel):
    asset_id: int = Field(description="所属域名资产 ID")
    host: str = Field(min_length=1, max_length=63, description="子域名主机名，如 www/api（@ 表示根域名）")
    record_type: Optional[str] = Field(default=None, description="DNS 记录类型")
    record_value: Optional[str] = Field(default=None, description="DNS 记录值")
    is_active: bool = Field(default=True, description="是否启用")
    note: Optional[str] = Field(default=None, description="备注")


class SubdomainUpdate(BaseModel):
    host: Optional[str] = Field(default=None, min_length=1, max_length=63)
    record_type: Optional[str] = Field(default=None)
    record_value: Optional[str] = Field(default=None)
    is_active: Optional[bool] = Field(default=None)
    note: Optional[str] = Field(default=None)


class SiteCertCreate(BaseModel):
    hostname: str = Field(min_length=1, max_length=253, description="探测目标主机名")
    port: int = Field(default=443, ge=1, le=65535, description="探测端口")
    asset_id: Optional[int] = Field(default=None, description="关联资产 ID（可选）")
