import request from "@/utils/request"

/** 畜牧医疗资源 — 分页列表 */
export function listMedicalResource(query) {
  return request({
    url: "/diseaseTreatment/medicalResource/list",
    method: "get",
    params: query
  })
}

/** 详情 */
export function getMedicalResource(id) {
  return request({
    url: "/diseaseTreatment/medicalResource/" + id,
    method: "get"
  })
}

/** 新增 */
export function addMedicalResource(data) {
  return request({
    url: "/diseaseTreatment/medicalResource",
    method: "post",
    data
  })
}

/** 修改 */
export function updateMedicalResource(data) {
  return request({
    url: "/diseaseTreatment/medicalResource",
    method: "put",
    data
  })
}

/** 删除 */
export function delMedicalResource(ids) {
  return request({
    url: "/diseaseTreatment/medicalResource/" + ids,
    method: "delete"
  })
}

/** 发布 */
export function publishMedicalResource(id) {
  return request({
    url: "/diseaseTreatment/medicalResource/publish/" + id,
    method: "post"
  })
}

/** 下架 */
export function offlineMedicalResource(id) {
  return request({
    url: "/diseaseTreatment/medicalResource/offline/" + id,
    method: "post"
  })
}

/** 分配账号 */
export function assignAccountMedicalResource(id) {
  return request({
    url: "/diseaseTreatment/medicalResource/assignAccount/" + id,
    method: "post"
  })
}

/** 填报乡镇下拉（兽医所属乡镇） */
export function listMedicalResourceTownOptions() {
  return request({
    url: "/diseaseTreatment/medicalResource/townOptions",
    method: "get"
  })
}

/** 批量发布 */
export function batchPublishMedicalResource(ids) {
  return request({
    url: "/diseaseTreatment/medicalResource/publish/batch",
    method: "post",
    data: { ids: ids.join(",") }
  })
}

/** 批量下架 */
export function batchOfflineMedicalResource(ids) {
  return request({
    url: "/diseaseTreatment/medicalResource/offline/batch",
    method: "post",
    data: { ids: ids.join(",") }
  })
}

/** 批量分配账号 */
export function batchAssignAccountMedicalResource(ids) {
  return request({
    url: "/diseaseTreatment/medicalResource/assignAccount/batch",
    method: "post",
    data: { ids: ids.join(",") }
  })
}
