package cn.keking.config;

import lombok.Data;
import org.apache.commons.compress.utils.Lists;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * @author Hikaru
 */
@Configuration
@ConfigurationProperties(prefix = "kkfile")
@Data
@Validated
public class KkfileConfig {

    /**
     * 默认10m
     */
    private static final long DEFAULT_TEMPLATE_MAX_SIZE = 10 * 1024 * 1024;

    private static final List<String> ALLOW_UPLOAD_TYPE =Arrays.asList("docx","xlsx");

    /**
     * 预览地址
     */
    private String localfileUrl;

    /*
     * jwt token
     */
    private  String token;


    /**
     * 模板文件默认大小
     */
    @NotNull(message = "模板文件默认大小不能为空")
    private Long templateMaxSize = DEFAULT_TEMPLATE_MAX_SIZE;

    /**
     * 允许得上传类型
     */
    @NotEmpty(message =  "允许得上传类型不能设置为空!")
    private List<String> allowUploadType = ALLOW_UPLOAD_TYPE;

}
