package com.yolo.keyboard.controller.admin.usercalllog.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;

@Schema(description = "管理后台 - 用户每次调用日志（用于记录token、模型、耗时、成功率等）新增/修改 Request VO")
@Data
public class KeyboardUserCallLogSaveReqVO {

    @Schema(description = "主键 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "32537")
    private Long id;

    @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22552")
    @NotNull(message = "用户ID不能为空")
    private Long userId;

    @Schema(description = "幂等请求ID，避免重试导致重复记录", requiredMode = Schema.RequiredMode.REQUIRED, example = "12645")
    @NotEmpty(message = "幂等请求ID，避免重试导致重复记录不能为空")
    private String requestId;

    @Schema(description = "调用功能来源", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "调用功能来源不能为空")
    private String feature;

    @Schema(description = "调用的模型名称")
    private String model;

    @Schema(description = "输入token数", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "输入token数不能为空")
    private Integer inputTokens;

    @Schema(description = "输出token数", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "输出token数不能为空")
    private Integer outputTokens;

    @Schema(description = "总token数（input+output）", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "总token数（input+output）不能为空")
    private Integer totalTokens;

    @Schema(description = "调用是否成功", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "调用是否成功不能为空")
    private Boolean success;

    @Schema(description = "调用耗时（毫秒）")
    private Integer latencyMs;

    @Schema(description = "失败错误码（可空）")
    private String errorCode;

    @Schema(description = "调用记录创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "调用记录创建时间不能为空")
    private LocalDateTime createdAt;

    @Schema(description = "生成 id", example = "2813")
    private String genId;

}