package cd.casic.module.terminal.define.config;

import cd.casic.module.terminal.common.config.ConfigRef;
import cd.casic.module.terminal.common.config.ConfigStore;
import cd.casic.module.terminal.common.constant.ConfigKeys;
import org.springframework.stereotype.Component;

/**
 * 应用 sftp 配置
 *
 * @author Jiahang Li
 * @version 1.0.0
 * @since 2024/4/15 22:00
 */
@Component
public class AppSftpConfig {

    /**
     * 文件预览大小
     */
    private final ConfigRef<Integer> previewSize;

    /**
     * 重复文件备份
     */
    private final ConfigRef<Boolean> uploadPresentBackup;

    /**
     * 备份文件名称
     */
    private final ConfigRef<String> uploadBackupFileName;

    public AppSftpConfig(ConfigStore configStore) {
        this.previewSize = configStore.int32(ConfigKeys.SFTP_PREVIEW_SIZE);
        this.uploadPresentBackup = configStore.bool(ConfigKeys.SFTP_UPLOAD_PRESENT_BACKUP);
        this.uploadBackupFileName = configStore.string(ConfigKeys.SFTP_UPLOAD_BACKUP_FILE_NAME);
    }

    public Integer getPreviewSize() {
        return previewSize.value;
    }

    public Boolean getUploadPresentBackup() {
        return uploadPresentBackup.value;
    }

    public String getUploadBackupFileName() {
        return uploadBackupFileName.value;
    }

}
