package com.zioinfo.signage.service;

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

@Service
@RequiredArgsConstructor
public class TemplateGroupService {
    private final TemplateGroupMapper mapper;

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

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

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

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

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