import request from "@/utils/request";

// 查询值班规则列表
export function listRules(query) {
  return request({
    url: "/duty/rules/list",
    method: "get",
    params: query,
  });
}

// 查询值班规则详细
export function getRules(id) {
  return request({
    url: "/duty/rules/" + id,
    method: "get",
  });
}

// 新增值班规则
export function addRules(data) {
  return request({
    url: "/duty/rules",
    method: "post",
    data: data,
  });
}

// 保存值班规则
export function addList(data) {
  return request({
    url: "/duty/rules/addList",
    method: "post",
    data: data,
  });
}

// 修改值班规则
export function updateRules(data) {
  return request({
    url: "/duty/rules",
    method: "put",
    data: data,
  });
}

// 删除值班规则
export function delRules(id) {
  return request({
    url: "/duty/rules/" + id,
    method: "delete",
  });
}

// 根据上一个月生成当前月规则
export function lastAutomaticallyDuty(yearMonth) {
  return request({
    url: "/duty/duty/lastAutomaticallyDuty",
    method: "POST",
    params: { yearMonth },
  });
}
// 生成本月排班
export function automaticallyDuty(yearMonth) {
  return request({
    url: "/duty/duty/automaticallyDuty",
    method: "POST",
    params: { yearMonth },
  });
}
// 生成排班
export function toGenerateDutyData(createDate) {
  return request({
    url: "/duty/duty/toGenerateDutyData",
    method: "POST",
    params: { createDate },
  });
}
// 检査当前日期是否存在值班数据
export function toCheckExistDutyData(createDate) {
  return request({
    url: "/duty/duty/toCheckExistDutyData",
    method: "POST",
    params: { createDate },
  });
}
