package com.cf.imes.module.report.controller.admin.datasource.vo;

import com.cf.imes.module.report.validation.datasource.SqlIllegalValid;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.List;

/**
 * @author Gqr
 * @since 2024/10/16 16:39
 */
@Schema(description = "管理后台 - 报表数据源预览 Request VO")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ReportDatasourcePreviewReqVO {
    @Schema(description = "数据源连接信息")
    @NotNull(message = "数据源连接信息不能为空")
    @Valid
    private ReportDatasourceTestConnReqVO info;

    @Schema(description = "查询语句")
    @NotBlank(message = "查询语句不能为空")
    @SqlIllegalValid
    private String sql;

    @Schema(description = "查询参数列表")
    @Size(max = 30, message = "查询参数列表数量不能超过30个")
    @Valid
    private List<ReportDatasourceParameterVO> parameters;

    @Schema(description = "数据源编号")
    @NotNull(message = "数据源编号不能为空")
    private Long datasourceId;
}
