package com.ai.da.common.config;

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

/**
 * @author yanglei
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "file")
public class FileProperties {

    private ElPath mac;

    private ElPath linux;

    private ElPath windows;

    private String linuxDomain;

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

    public String getLinuxDomain() {
        String os = System.getProperty("os.name");
        if ((!os.toLowerCase().startsWith("win")) && (!os.toLowerCase().startsWith("mac"))) {
            return linuxDomain;
        }
        return null;
    }

    @Data
    public static class ElPath {
        private String path;
    }
}
