package com.utopiaindustries.restcontroller;

import com.utopiaindustries.service.JobCardService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping( "/rest/cut-pieces" )
public class CutPieceRestController {

    private final JobCardService jobCardService;

    public CutPieceRestController(JobCardService jobCardService) {
        this.jobCardService = jobCardService;
    }

    @PostMapping
    public String deleteJobCardItemPiece( @RequestParam("cut-piece-id") long cutPieceId ){
        try {
            return jobCardService.deleteCutPieceItem( cutPieceId );
        } catch ( Exception e ){
            return e.getMessage();
        }
    }
}
