package org.nl.acs.agv.rest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.MagicAgvService;
import org.nl.common.logging.annotation.Log;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@Api(tags = "AGV任务")
@RequestMapping("/api/magic")
@Slf4j
public class MagicAgvController {
    private final MagicAgvService magicAgvService;

    @PostMapping("/agvack/{device}")
    @Log("AGV请求离开")
    @ApiOperation("AGV请求离开")
    //@PreAuthorize("@el.check('routePlan:list')")
    public ResponseEntity<Object> requestAck(@PathVariable String device) {
        return new ResponseEntity<>(magicAgvService.requestAck(device), HttpStatus.OK);
    }
}
