package com.zioinfo.signage.service;

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

@Service
@RequiredArgsConstructor
public class AdScheduleService {
    private final AdScheduleMapper mapper;

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

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

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

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

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