package cn.reghao.oss.store.db.repository;

import cn.reghao.oss.store.db.mapper.*;
import cn.reghao.oss.store.model.po.*;
import cn.reghao.oss.api.dto.media.AudioInfo;
import cn.reghao.oss.api.dto.media.AudioUrl;
import cn.reghao.oss.store.db.mapper.AudioFileMapper;
import cn.reghao.oss.store.model.po.AudioFile;
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);
    }
}
