namespace Tiku.Infrastructure.Storage;

public sealed class AliyunOssOptions
{
    public const string SectionName = "Storage:AliyunOss";

    public string? Region { get; set; }
    public string? Endpoint { get; set; }
    public string? AccessKeyId { get; set; }
    public string? AccessKeySecret { get; set; }
    public string? SecurityToken { get; set; }
    public bool UseInternalEndpoint { get; set; }
    public bool UsePathStyle { get; set; }
    public bool UseCName { get; set; }
    public int PresignDefaultMinutes { get; set; } = 15;

    public bool IsConfigured =>
        (!string.IsNullOrWhiteSpace(Region) || !string.IsNullOrWhiteSpace(Endpoint)) &&
        !string.IsNullOrWhiteSpace(AccessKeyId) &&
        !string.IsNullOrWhiteSpace(AccessKeySecret);

    public static bool BeValid(AliyunOssOptions options)
    {
        return options.PresignDefaultMinutes > 0;
    }
}