package com.zioinfo.signage.service;

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

@Service
@RequiredArgsConstructor
public class WorkService {
    private final WorkMapper mapper;

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

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

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

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

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