using Microsoft.Extensions.Logging;

using DomainResults.Common;

using MongoDB.Driver;

using DataProviders.Abstractions;

namespace DataProviders.Buckets {

  /// <summary>
  /// 
  /// </summary>
  public interface IImageBucketDataProvider {

    /// <summary>
    /// 
    /// </summary>
    /// <param name="siteId"></param>
    /// <param name="userId"></param>
    /// <param name="file"></param>
    /// <returns></returns>
    (Guid?, IDomainResult) Upload(Guid siteId, Guid userId, BucketFile file);

    /// <summary>
    /// 
    /// </summary>
    /// <param name="siteId"></param>
    /// <param name="userId"></param>
    /// <param name="files"></param>
    /// <returns></returns>
    (List<Guid>?, IDomainResult) UploadMany(Guid siteId, Guid userId, List<BucketFile> files);

    /// <summary>
    /// 
    /// </summary>
    /// <param name="siteId"></param>
    /// <param name="fileId"></param>
    /// <returns></returns>
    (BucketFile?, IDomainResult) Download(Guid siteId, Guid fileId);

    /// <summary>
    /// 
    /// </summary>
    /// <param name="siteId"></param>
    /// <param name="userId"></param>
    /// <param name="fileId"></param>
    /// <returns></returns>
    (BucketFile?, IDomainResult) Download(Guid siteId, Guid userId, Guid fileId);

    /// <summary>
    /// 
    /// </summary>
    /// <param name="siteId"></param>
    /// <param name="userId"></param>
    /// <param name="fileId"></param>
    /// <returns></returns>
    IDomainResult DeleteOne(Guid siteId, Guid userId, Guid fileId);

    /// <summary>
    /// 
    /// </summary>
    /// <param name="siteId"></param>
    /// <param name="userId"></param>
    /// <returns></returns>
    IDomainResult DeletMany(Guid siteId, Guid userId);
  }

  /// <summary>
  /// 
  /// </summary>
  public class ImageBucketDataProvider : SpecificBucketDataProviderBase, IImageBucketDataProvider {

    /// <summary>
    /// 
    /// </summary>
    /// <param name="logger"></param>
    /// <param name="client"></param>
    public ImageBucketDataProvider(
      ILogger<BucketDataProviderBase> logger,
      IMongoClient client
    ) : base(logger, client, "images") { }
  }
}
