package com.zioinfo.signage.service;

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

@Service
@RequiredArgsConstructor
public class RegionService {
    private final RegionMapper mapper;

    public List<RegionVo> list(String tenantCode, String keyword) {
        return mapper.findAll(tenantCode, keyword);
    }

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

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

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

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