package com.ffii.fpsms.modules.master.web

import com.ffii.core.utils.CriteriaArgsBuilder
import com.ffii.fpsms.modules.master.entity.projections.QcCheckInfo
import com.ffii.fpsms.modules.master.service.QcCheckService
import com.ffii.fpsms.modules.master.web.models.MessageResponse
import com.ffii.fpsms.modules.master.web.models.NewItemRequest
import com.ffii.fpsms.modules.master.web.models.NewQcCheckRequest
import jakarta.servlet.http.HttpServletRequest
import jakarta.validation.Valid
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("/qcCheck")
class QcCheckController(
    private val qcCheckService: QcCheckService
) {
    @PostMapping("/new")
    fun saveItem(@Valid @RequestBody newQcs: List<NewQcCheckRequest>): MessageResponse {
        return qcCheckService.saveQcChecks(newQcs)
    }

    @GetMapping
    fun allQcCheckInfo(): List<QcCheckInfo> {
        return qcCheckService.getAllQcCheckInfo()
    }
    @GetMapping("/{itemId}")
    fun allQcCheckInfoByItemId(@PathVariable itemId: Long): List<QcCheckInfo> {
        return qcCheckService.getAllQcCheckInfoById(itemId)
    }
}