package com.zioinfo.mall.event.mapper;

import com.zioinfo.mall.event.MallEvent;
import com.zioinfo.mall.event.MallEventBanner;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface EventMapper {
    // 이벤트
    List<MallEvent> findEvents(@Param("status") String status, @Param("type") String type,
                               @Param("activeOnly") Boolean activeOnly);
    List<MallEvent> findOngoing(@Param("tier") String tier);
    MallEvent findById(@Param("id") Long id);
    MallEvent findByCode(@Param("code") String code);
    int insert(MallEvent e);
    int update(MallEvent e);
    int updateStatus(@Param("id") Long id, @Param("status") String status);
    int delete(@Param("id") Long id);

    // 배너
    List<MallEventBanner> findBanners(@Param("eventId") Long eventId, @Param("activeOnly") Boolean activeOnly);
    List<MallEventBanner> findActiveBanners();
    int insertBanner(MallEventBanner b);
    int deleteBanner(@Param("id") Long id);
    int deleteBannersByEvent(@Param("eventId") Long eventId);

    // 참여/성과
    int insertParticipation(@Param("eventId") Long eventId, @Param("owner") String owner,
                            @Param("couponId") Long couponId, @Param("orderNo") String orderNo,
                            @Param("reward") String reward);
    Map<String, Object> performance(@Param("eventId") Long eventId);
}
