import request from '@/config/axios'

// ERP 固定资产折旧 VO
export interface AssetDepreciationVO {
  id: number // 主键
  assetNo: string // 资产编号
  assetName: string // 资产名称
  assetCategory: string // 资产类别
  originalValue: number // 原值
  usefulLife: number // 使用年限（年）
  monthlyDepreciation: number // 本月折旧
  monthlyExpense: number // 当月费用
  accumulatedDepreciation: number // 累计折旧
  createTime: Date // 创建时间
}

// ERP 固定资产折旧 API
export const AssetDepreciationApi = {
  // 查询固定资产折旧分页
  getAssetDepreciationPage: async (params: any) => {
    return await request.get({ url: `/erp/asset-depreciation/page`, params })
  },

  // 查询固定资产折旧详情
  getAssetDepreciation: async (id: number) => {
    return await request.get({ url: `/erp/asset-depreciation/get?id=` + id })
  },

  // 新增固定资产折旧
  createAssetDepreciation: async (data: AssetDepreciationVO) => {
    return await request.post({ url: `/erp/asset-depreciation/create`, data })
  },

  // 修改固定资产折旧
  updateAssetDepreciation: async (data: AssetDepreciationVO) => {
    return await request.put({ url: `/erp/asset-depreciation/update`, data })
  },

  // 删除固定资产折旧
  deleteAssetDepreciation: async (id: number) => {
    return await request.delete({ url: `/erp/asset-depreciation/delete?id=` + id })
  },

  // 导出固定资产折旧 Excel
  exportAssetDepreciation: async (params: any) => {
    return await request.download({ url: `/erp/asset-depreciation/export-excel`, params })
  }
}
