package org.springblade.modules.resource.builder.oss;

import org.springblade.core.oss.rule.OssRule;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.FileUtil;
import org.springblade.core.tool.utils.StringUtil;

public class StHzOssRule implements OssRule {
	private final Boolean tenantMode;

	@Override
	public String bucketName(String bucketName) {
		String prefix = this.tenantMode ? AuthUtil.getTenantId().concat("-") : "";
		return prefix + bucketName;
	}

	public String fileName(String originalFilename) {
		return "upload/" + DateUtil.today() + "/" + originalFilename;
	}

	public StHzOssRule(final Boolean tenantMode) {
		this.tenantMode = tenantMode;
	}
}
