package com.zioinfo.signage.service;

import com.zioinfo.signage.domain.AlarmVo;
import com.zioinfo.signage.mapper.AlarmMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
@RequiredArgsConstructor
public class AlarmService {
    private final AlarmMapper mapper;

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

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

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

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

    public void resolve(Long id, String resolvedBy, String resolution) {
        mapper.resolve(id, resolvedBy, resolution);
    }

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