package sgc.portal.base.storage.service;

import sgc.portal.base.storage.model.FileBucket;
import sgc.portal.base.storage.Subpath;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * 파일 업/다운로드 비즈니스 로직 인터페이스
 *
 * @author YongSang
 * @version 1.0.0
 * @since 2020. 9. 5.
 */
public interface StorageService {
    /**
     * Store list.
     *
     * @param id             the id
     * @param multipartFiles the multipart files
     * @param subpath        the subpath
     * @return the list
     */
    List<FileBucket> store(String id, List<MultipartFile> multipartFiles, Subpath subpath);

    /**
     * Load file bucket.
     *
     * @param id the id
     * @return the file bucket
     */
    FileBucket load(String id);

    /**
     * Load file bucket.
     *
     * @param id         the id
     * @param backNumber the back number
     * @return the file bucket
     */
    FileBucket load(String id, Integer backNumber);

    /**
     * Load list.
     *
     * @param id          the id
     * @param backNumbers the back numbers
     * @return the list
     */
    List<FileBucket> load(String id, List<Integer> backNumbers);

    /**
     * Load all list.
     *
     * @param id the id
     * @return the list
     */
    List<FileBucket> loadAll(String id);

    /**
     * Load all list with thumb nail.
     *
     * @param id the id
     * @param thumbType the thumbType
     * @return the list
     */
    List<FileBucket> loadAllWithThumbnail(String id, String thumbType);
   
    /**
     * Remove.
     *
     * @param id the id
     */
    void remove(String id);

    /**
     * Remove.
     *
     * @param id          the id
     * @param backNumbers the back numbers
     */
    void remove(String id, List<Integer> backNumbers);

    /**
     * Remove all.
     *
     * @param id the id
     */
    void removeAll(String id);

    /**
     * Delete all.
     *
     * @param date the date
     */
    void deleteAll(String date);

    /**
     * Img stream internal string.
     *
     * @param id the id
     * @return the string
     * @throws IOException the io exception
     */
    String imgStreamInternal(String id) throws IOException;

    /**
     * Img stream internal string.
     *
     * @param id         the id
     * @param backNumber the back number
     * @return the string
     * @throws IOException the io exception
     */
    String imgStreamInternal(String id, Integer backNumber) throws IOException;

    /**
     * Img to hex internal string.
     *
     * @param id the id
     * @return the string
     * @throws IOException the io exception
     */
    String imgToHexInternal(String id) throws IOException;

    /**
     * Img to hex internal string.
     *
     * @param id         the id
     * @param backNumber the back number
     * @return the string
     * @throws IOException the io exception
     */
    String imgToHexInternal(String id, Integer backNumber) throws IOException;

}