import request from './request'

/**
 * 获取预算列表
 * @param {string} referenceDate 参考日期 (可选)
 */
export function getBudgetList(referenceDate) {
  return request({
    url: '/Budget/GetList',
    method: 'get',
    params: { referenceDate }
  })
}

/**
 * 获取单个预算统计
 * @param {number} id 预算ID
 * @param {string} referenceDate 参考日期
 */
export function getBudgetStatistics(id, referenceDate) {
  return request({
    url: '/Budget/GetStatistics',
    method: 'get',
    params: { id, referenceDate }
  })
}

/**
 * 创建预算
 * @param {object} data 预算数据
 */
export function createBudget(data) {
  return request({
    url: '/Budget/Create',
    method: 'post',
    data
  })
}

/**
 * 更新预算
 * @param {object} data 预算数据
 */
export function updateBudget(data) {
  return request({
    url: '/Budget/Update',
    method: 'post',
    data
  })
}

/**
 * 删除预算
 * @param {number} id 预算ID
 */
export function deleteBudget(id) {
  return request({
    url: `/Budget/DeleteById/${id}`,
    method: 'delete'
  })
}

/**
 * 切换预算状态 (停止/恢复)
 * @param {number} id 预算ID
 */
export function toggleStopBudget(id) {
  return request({
    url: '/Budget/ToggleStop',
    method: 'post',
    params: { id }
  })
}

