package com.zhongshu.card.server.core.model.upLoadFile;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;

import java.util.List;

/**
 * 远程文件
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RemoteGetTokenFileParam {

    @Schema(description = "平台oid或项目oid")
    @NotEmpty
    private String oid;

    //文件路径
    @Schema(description = "path", example = "['文件.docx']")
    private List<String> path;

    public List<String> getPath() {
        if (ObjectUtils.isNotEmpty(path)) {
            return path;
        }
        return List.of(fileName);
    }

    @Schema(description = "保留原名称")
    private Boolean isReserveName = Boolean.FALSE;

    @Schema(description = "fileName 文件名称")
    private String fileName;

    @Schema(description = "fileNames 文件列表")
    private List<String> fileNames;

    public List<String> getFileNames() {
        if (ObjectUtils.isNotEmpty(fileNames)) {
            return fileNames;
        }
        return this.path;
    }
}
