package com.fdkankan.fyun.http.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.File;

@Component
public class HttpFyunConfig {

    private Logger log = LoggerFactory.getLogger(this.getClass().getName());

    private String localTempPath;

    @Value("${fyun.https.file.upload}")
    private String uploadFile;

    @Value("${fyun.https.file.download}")
    private String downloadFile;

    @Value("${fyun.https.file.exist}")
    private String fileExist;

    @Value("${fyun.https.file.delete}")
    private String deleteFile;

    @Value("${fyun.https.file.copy}")
    private String copyFile;

    @Value("${fyun.https.dir.upload}")
    private String uploadDir;

    @Value("${fyun.https.dir.download}")
    private String downloadDir;

    @Value("${fyun.https.dir.delete}")
    private String deleteDir;

    @Value("${fyun.https.dir.copy}")
    private String copyDir;


    @Value("${fyun.https.local_temp_path:/fyun/temp/}")
    private void setLocalTempPath(String localTempPath) {
        this.localTempPath = localTempPath;
        if (new File(localTempPath).exists()) {
            new File(localTempPath).mkdirs();
        }
        log.info("创建临时文件目录成功：{}", localTempPath);
    }

    public String getLocalTempPath() {
        return localTempPath;
    }

    public String getUploadFile() {
        return uploadFile;
    }

    public String getDownloadFile() {
        return downloadFile;
    }


    public String getFileExist() {
        return fileExist;
    }


    public String getDeleteFile() {
        return deleteFile;
    }


    public String getCopyFile() {
        return copyFile;
    }


    public String getUploadDir() {
        return uploadDir;
    }


    public String getDownloadDir() {
        return downloadDir;
    }

    public String getDeleteDir() {
        return deleteDir;
    }

    public String getCopyDir() {
        return copyDir;
    }
}
