import request from '@/utils/request'

// 查询产羔记录列表（包含关联信息）
export function listLambing_records(query) {
  return request({
    url: '/breed/lambing_records/list',
    method: 'get',
    params: query
  })
}

// 查询产羔记录详细
export function getLambing_records(id) {
  return request({
    url: '/breed/lambing_records/' + id,
    method: 'get'
  })
}

// 根据母羊耳号查询最新配种记录
export function getBreedingInfo(earNumber) {
  return request({
    url: '/breed/lambing_records/breeding_info/' + earNumber,
    method: 'get'
  })
}

// 新增产羔记录（包含羔羊信息）
export function addLambing_records(data) {
  return request({
    url: '/breed/lambing_records',
    method: 'post',
    data: data
  })
}

// 修改产羔记录
export function updateLambing_records(data) {
  return request({
    url: '/breed/lambing_records',
    method: 'put',
    data: data
  })
}

// 删除产羔记录
export function delLambing_records(id) {
  return request({
    url: '/breed/lambing_records/' + id,
    method: 'delete'
  })
}

// 查询产羔详情（从羊只信息表查询羔羊信息）
export function getLambDetail(lambingRecordId) {
  return request({
    url: '/breed/lambing_records/lamb_detail/' + lambingRecordId,
    method: 'get'
  })
}

// 根据羊只ID查询羊只基础信息
export function getSheepInfo(sheepId) {
  return request({
    url: '/breed/sheep/info/' + sheepId,
    method: 'get'
  })
}

// 根据羊只ID查询配种记录
export function getBreedingRecord(sheepId, parity) {
  return request({
    url: '/breed/breeding_records/by_sheep/' + sheepId + '/' + parity,
    method: 'get'
  })
}

// 获取品种列表
export function getVarietyList() {
  return request({
    url: '/base/variety/list',
    method: 'get',
    params: {
      pageNum: 1,
      pageSize: 1000  // 获取所有品种
    }
  })
}