namespace Tiku.Infrastructure.Storage;

public sealed class ObjectStorageOptions
{
    public const string SectionName = "Storage";

    public string DefaultProvider { get; set; } = "local_dev";
    public string DefaultBucket { get; set; } = "tenant-assets";
    public string? PublicBaseUrl { get; set; }
    public long MaxUploadBytes { get; set; } = 1024L * 1024 * 500;
    public string[] AllowedMimePrefixes { get; set; } = ["image/", "video/", "audio/"];
    public string[] AllowedMimeTypes { get; set; } =
    [
        "application/pdf",
        "application/json",
        "text/csv",
        "application/vnd.ms-excel",
        "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
        "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    ];

    public bool RequireTenantPrefix { get; set; } = true;

    public static bool BeValid(ObjectStorageOptions options) =>
        options.MaxUploadBytes > 0 &&
        !string.IsNullOrWhiteSpace(options.DefaultProvider) &&
        !string.IsNullOrWhiteSpace(options.DefaultBucket);
}
