package sgc.portal.base.storage.persistence;

import sgc.portal.base.storage.model.FileBucket;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * The interface Storage mapper.
 *
 * @author YongSang
 */
@Mapper
public interface StorageMapper {
    /**
     * Insert int.
     *
     * @param fileBuckets the file buckets
     */
    void insert(FileBucket fileBuckets);

    /**
     * Update int.
     *
     * @param fileBucket the file bucket
     */
    void update(FileBucket fileBucket);

    /**
     * Delete int.
     *
     * @param id         the id
     * @param backNumber the back number
     */
    void delete(@Param("id") String id, @Param("backNumber") Integer backNumber);

    /**
     * Find by pk file bucket.
     *
     * @param id         the id
     * @param backNumber the back number
     * @return the file bucket
     */
    FileBucket findByPk(@Param("id") String id, @Param("backNumber") Integer backNumber);

    /**
     * Find by id file bucket.
     *
     * @param id the id
     * @return the file bucket
     */
    FileBucket findById(String id);

    /**
     * Find all by id list.
     *
     * @param id the id
     * @return the list
     */
    List<FileBucket> findAllById(String id);

    /**
     * Find all by id and back number in list.
     *
     * @param id          the id
     * @param backNumbers the back numbers
     * @return the list
     */
    List<FileBucket> findAllByIdAndBackNumberIn(@Param("id") String id, @Param("backNumbers") List<Integer> backNumbers);

    /**
     * Find all by deleted and create date less than list.
     *
     * @param date the date
     * @return the list
     */
    List<FileBucket> findAllByDeletedAndCreateDateLessThan(String date);
}