package com.storlead.mail.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @program: sp-sales-platform
 * @description:
 * @author: chenkq
 * @create: 2024-06-14 18:28
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "file")
public class MailFileProperties {

    /** 文件大小限制 */
    private Long maxSize;

    /** 头像大小限制 */
    private Long avatarMaxSize;

    /** 0:本地,1:OSS */
    private Integer mode = 0;

    /** 环境 */
    private String active = "";

    private ElPath mac;

    private String filePath;

    private ElPath linux;

    private ElPath windows;

    public ElPath getPath(){
        String os = System.getProperty("os.name");
        if(os.toLowerCase().startsWith("win")) {
            return windows;
        } else if(os.toLowerCase().startsWith("mac")){
            return mac;
        }
        return linux;
    }

    @Data
    public static class ElPath{

        private String path;

        private String avatar;

        private String jpeg;
    }
}
