import request from "@/utils/request"

/** 畜牧监控 — 分页列表 */
export function listLivestockMonitor(query) {
  return request({
    url: "/videoSurveillance/livestockMonitor/list",
    method: "get",
    params: query
  })
}

/** 详情 */
export function getLivestockMonitor(id) {
  return request({
    url: "/videoSurveillance/livestockMonitor/" + id,
    method: "get"
  })
}

/** 新增 */
export function addLivestockMonitor(data) {
  return request({
    url: "/videoSurveillance/livestockMonitor",
    method: "post",
    data
  })
}

/** 修改 */
export function updateLivestockMonitor(data) {
  return request({
    url: "/videoSurveillance/livestockMonitor",
    method: "put",
    data
  })
}

/** 删除 */
export function delLivestockMonitor(ids) {
  return request({
    url: "/videoSurveillance/livestockMonitor/" + ids,
    method: "delete"
  })
}

/** 所属主体下拉（养殖主体 + 交易市场，支持 keyword 模糊） */
export function listLivestockMonitorOwnerOptions(query) {
  return request({
    url: "/videoSurveillance/livestockMonitor/ownerOptions",
    method: "get",
    params: query
  })
}

/** 第三方同步（仅列表 upsert） */
export function syncLivestockMonitor() {
  return request({
    url: "/videoSurveillance/livestockMonitor/sync",
    method: "post"
  })
}

/** 实时播放地址（不落库） */
export function getLivestockMonitorPlayUrl(monitorId) {
  return request({
    url: "/videoSurveillance/livestockMonitor/playUrl",
    method: "get",
    params: { monitorId }
  })
}
