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 = "report.datasource.preview.conn.test.info.notNull")
    @Valid
    private ReportDatasourceTestConnReqVO info;

    @Schema(description = "查询语句")
    @NotBlank(message = "report.datasource.preview.sql.notBlank")
    @SqlIllegalValid
    private String sql;

    @Schema(description = "查询参数列表")
    @Size(max = 30, message = "report.datasource.preview.parameters.size")
    @Valid
    private List<ReportDatasourceParameterVO> parameters;

    @Schema(description = "数据源编号")
    @NotNull(message = "report.datasource.preview.datasourceId.notNull")
    private Long datasourceId;
}
