package cn.reghao.tnb.content.app.data.db.repository;

import cn.reghao.tnb.content.app.data.db.mapper.AudioFileMapper;
import cn.reghao.tnb.content.app.data.model.po.AudioFile;
import cn.reghao.oss.sdk.model.dto.media.AudioInfo;
import cn.reghao.oss.sdk.model.dto.media.AudioUrl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author reghao
 * @date 2023-08-28 15:00:43
 */
@Repository
public class AudioRepository {
    private final AudioFileMapper audioFileMapper;

    public AudioRepository(AudioFileMapper audioFileMapper) {
        this.audioFileMapper = audioFileMapper;
    }

    public void saveAudioFiles(List<AudioFile> audioFiles) {
        audioFileMapper.saveAll(audioFiles);
    }

    public List<AudioFile> findAudioFiles(String audioFileId) {
        return audioFileMapper.findByAudioFileId(audioFileId);
    }

    public List<AudioInfo> getAudioInfo(String audioFileId) {
        return audioFileMapper.findAudioInfo(audioFileId);
    }

    public List<AudioUrl> getAudioUrls(String audioFileId) {
        return audioFileMapper.findAudioUrl(audioFileId);
    }
}
