package com.zioinfo.esn.service;

import com.zioinfo.esn.domain.HCoreVo;
import com.zioinfo.esn.mapper.HCoreMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
@RequiredArgsConstructor
public class HCoreService {
    private final HCoreMapper mapper;

    public List<HCoreVo> list(String tenantCode, Long storeId, String deviceType, String status) {
        return mapper.findAll(tenantCode, storeId, deviceType, status);
    }

    public HCoreVo get(Long id) { return mapper.findById(id); }

    public HCoreVo create(HCoreVo v) {
        mapper.insert(v);
        return mapper.findById(v.getId());
    }

    public HCoreVo update(Long id, HCoreVo v) {
        v.setId(id);
        mapper.update(v);
        return mapper.findById(id);
    }

    public void updateStatus(Long id, String status) {
        mapper.updateStatus(id, status);
    }

    public void delete(Long id) { mapper.delete(id); }
}
