package com.ruoyi.wgz.service;

import com.ruoyi.wgz.bo.req.WgzAppCancelLeaveReq;
import com.ruoyi.wgz.bo.req.WgzAppLeaveHistoryListPageReq;
import com.ruoyi.wgz.bo.req.WgzAppSubmitLeaveReq;
import com.ruoyi.wgz.bo.res.WgzAppLeaveHistoryListPageRes;
import com.ruoyi.wgz.domain.WgzLeave;
import com.ruoyi.wgz.bo.WgzLeaveQueryBo;
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;

import java.time.LocalDate;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * 请假Service接口
 *
 * @author ruoyi
 * @date 2025-02-19
 */
public interface IWgzLeaveService extends IServicePlus<WgzLeave> {
    /**
     * 查询单个
     * @return
     */
    WgzLeave queryById(Long id);

    /**
     * 查询列表
     */
    TableDataInfo<WgzLeave> queryPageList(WgzLeaveQueryBo bo);

    /**
     * 查询列表
     */
    List<WgzLeave> queryList(WgzLeaveQueryBo bo);

    /**
     * 根据新增业务对象插入请假
     * @param bo 请假新增业务对象
     * @return
     */
    Boolean insert(WgzLeave bo);

    /**
     * 根据编辑业务对象修改请假
     * @param bo 请假编辑业务对象
     * @return
     */
    Boolean update(WgzLeave bo);

    /**
     * 校验并删除数据
     * @param ids 主键集合
     * @param isValid 是否校验,true-删除前校验,false-不校验
     * @return
     */
    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);


	/**
	 * APP相关
	 * =================================================================================================================
	 * =================================================================================================================
	 * =================================================================================================================
	 */

	/*
	 * 提交请假申请
	 */
	Boolean userSubmitLeave(@Validated @RequestBody WgzAppSubmitLeaveReq req);

    /*
     * 历史请假申请记录
     */
    TableDataInfo<WgzAppLeaveHistoryListPageRes> userLeaveHistoryListPage(@Validated WgzAppLeaveHistoryListPageReq req);

    /*
     * 取消请假申请
     */
    Boolean userCancelLeave(@Validated @RequestBody WgzAppCancelLeaveReq req);

    /*
     * 查看指定人、指定项目、指定月是否请假（只传递年月）
     */
    Map<LocalDate, LocalDate> selectByUserCancelLeave(String yearMonth);

	/*
	 * 查看指定人、指定项目、指定日期是否请假
	 */
	WgzLeave FindAskForLeaveOrNotInfo(Long appUserId, Long recruitId, String date);
}
