/**
 * BladeX Commercial License Agreement
 * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
 * <p>
 * Use of this software is governed by the Commercial License Agreement
 * obtained after purchasing a license from BladeX.
 * <p>
 * 1. This software is for development use only under a valid license
 * from BladeX.
 * <p>
 * 2. Redistribution of this software's source code to any third party
 * without a commercial license is strictly prohibited.
 * <p>
 * 3. Licensees may copyright their own code but cannot use segments
 * from this software for such purposes. Copyright of this software
 * remains with BladeX.
 * <p>
 * Using this software signifies agreement to this License, and the software
 * must not be used for illegal purposes.
 * <p>
 * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
 * not liable for any claims arising from secondary or illegal development.
 * <p>
 * Author: Chill Zhuang (bladejava@qq.com)
 */
package org.springblade.file.config;

import lombok.Data;

/**
 * 文件存储配置
 *
 * @author Chill
 */
@Data
public class FileStorageProperties {

	/**
	 * 存储类型，auto按obs、minio、oss、local优先级自动选择
	 */
	private String type = "auto";

	/**
	 * MinIO配置
	 */
	private StoreProperties minio = new StoreProperties();

	/**
	 * 阿里云OSS配置
	 */
	private StoreProperties oss = new StoreProperties();

	/**
	 * 本地文件配置
	 */
	private LocalProperties local = new LocalProperties();

	@Data
	public static class StoreProperties {

		/**
		 * 资源地址
		 */
		private String endpoint;

		/**
		 * 外网资源地址
		 */
		private String transformEndpoint;

		/**
		 * AccessKey
		 */
		private String accessKeyId;

		/**
		 * SecretKey
		 */
		private String accessKeySecret;

		/**
		 * 桶名
		 */
		private String bucketName;

		/**
		 * 根目录
		 */
		private String rootDirectory;

		/**
		 * 链接过期时间，单位秒
		 */
		private Long expires = 3600L;
	}

	@Data
	public static class LocalProperties {

		/**
		 * 本地存储根目录
		 */
		private String rootPath = "tmp/file-storage";

		/**
		 * 文件访问地址
		 */
		private String accessUrl = "http://127.0.0.1:8107/file/static";

		/**
		 * 链接过期时间，单位秒，本地存储暂不校验
		 */
		private Long expires = 3600L;
	}
}
