package com.sikey.wa04.api.user.client.rest;

import com.sikey.wa04.business.application.service.user.AlarmClockService;
import com.sikey.wa04.business.infrastructure.configuration.ProjectContextConstant;
import com.sikey.wa04.business.infrastructure.dto.request.alarmclock.CreateAlarmClockRequest;
import com.sikey.wa04.business.infrastructure.dto.request.alarmclock.DeleteAlarmClockRequest;
import com.sikey.wa04.business.infrastructure.dto.request.alarmclock.GetallAlarmClockRequest;
import com.sikey.wa04.business.infrastructure.dto.request.alarmclock.UpdateAlarmClockRequest;
import com.sikey.wa04.business.infrastructure.dto.response.alarmclock.GetallAlarmClockResponse;
import com.sikey.wa04.common.BaseController;
import com.sikey.wa04.common.dto.header.GenericManufacturerHeader;
import com.sikey.wa04.common.interceptor.Authenticated;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

/**
 * 闹钟
 *
 * @author luoyangwei
 * @date 2024年10月16日17:30:15
 */
@RestController
@RequestMapping(ProjectContextConstant.USER_CONTEXT_URL + "/user/alarm-clock")
public class AlarmClockController extends BaseController {
    @Resource
    private AlarmClockService alarmClockService;

    @Authenticated
    @PostMapping("/create")
    public void create(@Valid @RequestBody CreateAlarmClockRequest request) {
        GenericManufacturerHeader genericManufacturerHeader = genericManufacturerHeader();
        alarmClockService.create(request,genericManufacturerHeader);
    }

    @Authenticated
    @PostMapping("/update")
    public void update(@Valid @RequestBody UpdateAlarmClockRequest request) {
        GenericManufacturerHeader genericManufacturerHeader = genericManufacturerHeader();
        alarmClockService.update(request,genericManufacturerHeader);
    }

    @Authenticated
    @GetMapping("/delete")
    public void delete(@Valid DeleteAlarmClockRequest request) {
        GenericManufacturerHeader genericManufacturerHeader = genericManufacturerHeader();
        alarmClockService.delete(request,genericManufacturerHeader);
    }

    @Authenticated
    @GetMapping("/getall")
    public GetallAlarmClockResponse getall(@Valid GetallAlarmClockRequest request) {
        GenericManufacturerHeader genericManufacturerHeader = genericManufacturerHeader();
        return alarmClockService.getall(request,genericManufacturerHeader, false);
    }

}
