package com.aucma.dms.service;

import com.aucma.dms.domain.DmsBillsInspectInstance;
import com.aucma.dms.domain.DmsInspectInstanceDetail;
import com.aucma.dms.domain.vo.DmsBillsInspectInstanceScanVo;

import java.util.List;

/**
 * 巡检工单Service接口
 *
 * @author Open Platform
 * @date 2024-01-23
 */
public interface IDmsBillsInspectInstanceService
{
    /**
     * 查询巡检工单
     *
     * @param inspectInstanceId 巡检工单主键
     * @return 巡检工单
     */
    public DmsBillsInspectInstance selectDmsBillsInspectInstanceByInspectInstanceId(Long inspectInstanceId);

    /**
     * 查询巡检工单列表
     *
     * @param dmsBillsInspectInstance 巡检工单
     * @return 巡检工单集合
     */
    public List<DmsBillsInspectInstance> selectDmsBillsInspectInstanceList(DmsBillsInspectInstance dmsBillsInspectInstance);
    public List<DmsBillsInspectInstance> selectPoint();
    public List<DmsBillsInspectInstance> selectInspection();



    /**
     * 新增巡检工单
     *
     * @param dmsBillsInspectInstance 巡检工单
     * @return 结果
     */
    public int insertDmsBillsInspectInstance(DmsBillsInspectInstance dmsBillsInspectInstance);

    /**
     * 修改巡检工单
     *
     * @param dmsBillsInspectInstance 巡检工单
     * @return 结果
     */
    public int updateDmsBillsInspectInstance(DmsBillsInspectInstance dmsBillsInspectInstance);

    /**
     * 批量删除巡检工单
     *
     * @param inspectInstanceIds 需要删除的巡检工单主键集合
     * @return 结果
     */
    public int deleteDmsBillsInspectInstanceByInspectInstanceIds(Long[] inspectInstanceIds);

    /**
     * 删除巡检工单信息
     *
     * @param inspectInstanceId 巡检工单主键
     * @return 结果
     */
    public int deleteDmsBillsInspectInstanceByInspectInstanceId(Long inspectInstanceId);

    int insertDmsBillsInspectInstancePDA(DmsBillsInspectInstance dmsBillsInspectInstance);

    /**
     * 获取最新一条未完成的巡检工单
     *
     * @param dmsBillsInspectInstance
     * @return
     */
    public DmsBillsInspectInstance getNewestBillsInspectInstance(DmsBillsInspectInstance dmsBillsInspectInstance);

    /**
     * 扫描设备验证并获取巡检项目信息
     * @param dmsBillsInspectInstanceScanVo
     * @return
     */
    public DmsInspectInstanceDetail scanInspectInstanceDetail(DmsBillsInspectInstanceScanVo dmsBillsInspectInstanceScanVo);

    /**
     * 更新点巡检工单明细
     *
     * @param dmsInspectInstanceDetail 点巡检工单明细
     * @return 结果
     */
    public int updateDmsInspectInstanceDetail(DmsInspectInstanceDetail dmsInspectInstanceDetail);

    /**
     * 获取工单设备列表（网页版巡检执行）
     *
     * @param inspectInstanceId 巡检工单ID
     * @return 设备明细列表
     */
    public List<DmsInspectInstanceDetail> getDeviceList(Long inspectInstanceId);

    /**
     * 更新设备检查状态（简化版，只更新合格/不合格）
     *
     * @param detail 设备明细
     * @return 结果
     */
    public int updateDeviceStatus(DmsInspectInstanceDetail detail);

    /**
     * 定时任务专用：创建已完成状态的巡检工单（含明细），路线所有设备默认正常
     *
     * @param dmsBillsInspectInstance 巡检工单（需设置planInspectId、inspectRouteId、inspectType等）
     * @return 结果
     */
    int insertCompletedInspectInstance(DmsBillsInspectInstance dmsBillsInspectInstance);
}
