package com.zioinfo.signage.service;

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

@Service
@RequiredArgsConstructor
public class GatewayService {
    private final GatewayMapper mapper;

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

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

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

    public GatewayVo update(Long id, GatewayVo 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); }
}
