using BPA.Aliyun.OSS;
using BPA.Aliyun.OSS.Options;
using BPA.SAAS.Manage.Application.System.Dtos;
using BPA.SAAS.Manage.Application.System.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.System.Services
{
    public class AliyunOssService : IAliyunOssService, ITransient
    {
        private readonly ISqlSugarClient _db;
        private AliyunOssClient _aliyunOssClient;
        public AliyunOssService(ISqlSugarClient db, AliyunOssClient aliyunOssClient)
        {
            _db = db;
            _aliyunOssClient = aliyunOssClient;
        }

        public async Task<AliyunOssPostPolicyResponse> GeneratePostPolicyAsync(Aliyun0ssGeneratePostPolicyRequest request)
        {
            var dir = request.Directory;
            dir = !dir.EndsWith("/") ? dir + "/" : dir;
            var data = await _aliyunOssClient.GeneratePostPolicyAsync(dir);
            return data;
        }
    }
}
