import request from '@/utils/request'

// 查询采精记录列表
export function listSperm(query) {
  return request({
    url: '/Sperm/Sperm/list',
    method: 'get',
    params: query
  })
}

// 查询采精记录详细
export function getSperm(id) {
  return request({
    url: '/Sperm/Sperm/' + id,
    method: 'get'
  })
}

// 新增采精记录
export function addSperm(data) {
  return request({
    url: '/Sperm/Sperm',
    method: 'post',
    data: data
  })
}

// 修改采精记录
export function updateSperm(data) {
  return request({
    url: '/Sperm/Sperm',
    method: 'put',
    data: data
  })
}

// 删除采精记录
export function delSperm(id) {
  return request({
    url: '/Sperm/Sperm/' + id,
    method: 'delete'
  })
}

// 根据耳号查询羊只信息（带性别验证）
export function getSheepByManageTags(manageTags) {
  return request({
    url: '/Sperm/Sperm/getSheepByManageTags/' + manageTags,
    method: 'get'
  })
}

// 验证羊只是否为公羊
export function validateRam(manageTags) {
  return request({
    url: '/Sperm/Sperm/validateRam/' + manageTags,
    method: 'get'
  })
}

// 根据耳号查询羊只ID（兼容原有接口）
export function getSheepIdByManageTags(manageTags) {
  return request({
    url: '/Sperm/Sperm/getSheepIdByManageTags/' + manageTags,
    method: 'get'
  })
}

// 导出采精记录
export function exportSperm(query) {
  return request({
    url: '/Sperm/Sperm/export',
    method: 'post',
    data: query,
    responseType: 'blob'
  })
}