package com.remax.visualnovel.repository.api

import com.remax.visualnovel.api.service.OssService
import com.remax.visualnovel.entity.request.ImgCheckDTO
import com.remax.visualnovel.entity.request.S3TypeDTO
import com.remax.visualnovel.entity.request.SimpleContentDTO
import com.remax.visualnovel.entity.response.BucketBean
import com.remax.visualnovel.entity.response.base.Response
import com.remax.visualnovel.repository.api.base.BaseRepository
import javax.inject.Inject

/**
 * Created by HJW on 2022/10/27
 *
 * 应用相关
 */
class OssRepository @Inject constructor(
    private val ossService: OssService
) : BaseRepository() {

    /**
     * 获取aws s3 bucket信息
     */
    suspend fun getS3Bucket(ossType: String, postfix: String): Response<BucketBean> =
        executeHttp {
            val bucketDTO = S3TypeDTO(ossType, postfix)
            ossService.getS3Bucket(bucketDTO)
        }

    /**
     * 图片鉴黄
     */
    suspend fun checkS3Img(imgCheckDTO: ImgCheckDTO): Response<Any> =
        executeHttp {
            ossService.checkS3Img(imgCheckDTO = imgCheckDTO)
        }

    suspend fun checkText(content: String): Response<Any> =
        executeHttp {
            ossService.checkText(simpleContentDTO = SimpleContentDTO(content))
        }

}