package storage import ( "context" "fmt" "io" "github.com/youruser/base/internal/config" ) // Storage defines the interface for file storage backends. type Storage interface { Upload(ctx context.Context, key string, reader io.Reader, size int64, contentType string) error Delete(ctx context.Context, key string) error GetURL(ctx context.Context, key string) (string, error) Exists(ctx context.Context, key string) (bool, error) } // NewStorage creates the appropriate storage backend from config. func NewStorage(cfg config.StorageConfig) (Storage, error) { switch cfg.Type { case "local": return NewLocalStorage(cfg.Local) case "oss": return NewOSSStorage(cfg.OSS) case "minio": return NewMinIOStorage(cfg.MinIO) default: return nil, fmt.Errorf("unsupported storage type: %s", cfg.Type) } }