import { BatteryAccModel, BatteryAccQueryParam } from '@/types'
import request from '@/until/request'

/**
 * 获取电池台账列表
 * @param data BatteryAccQueryParam
 */
const QueryBatteryAccList = (data: BatteryAccQueryParam) =>
    request({
        url: '/BatteryAccAction/findAllBatteryAcc',
        method: 'post',
        data: data
    })

/**
* 新增电池台账
* @param data BatteryAccModel
*/
const AddBatteryAcc = (data: BatteryAccModel) =>
    request({
        url: '/BatteryAccAction/saveBatteryAcc',
        method: 'post',
        data: data
    })

/**
* 编辑电池台账
* @param data BatteryAccModel
*/
const EditBatteryAcc = (data: BatteryAccModel) =>
    request({
        url: '/BatteryAccAction/updateBatteryAcc',
        method: 'post',
        data: data
    })

/**
* 删除电池台账
* @param  id number
*/
const DeleteBatteryAcc = (id: number) =>
    request({
        url: '/BatteryAccAction/deleteBatteryAcc/' + id,
        method: 'get',
    })

/**
 * 根据SN查询台账
 * @param BatterySn 
 * @returns 
 */
const FindBatteryAccBysn = (BatterySn: string) =>
    request({
        url: '/BatteryAccAction/findBatteryAccBysn/' + BatterySn,
        method: 'get',
    })

export default {
    QueryBatteryAccList,
    AddBatteryAcc,
    EditBatteryAcc,
    DeleteBatteryAcc,
    FindBatteryAccBysn
}