package com.ycwl.basic.controller.pc;

import com.ycwl.basic.model.pc.renderWorker.entity.RenderWorkerEntity;
import com.ycwl.basic.model.pc.renderWorker.req.RenderWorkerReqQuery;
import com.ycwl.basic.service.pc.RenderWorkerService;
import com.ycwl.basic.utils.ApiResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author：longbinbin
 * @Date：2024/12/3 14:59
 */
@RestController
@RequestMapping("/api/renderWorker/v1")
@Api(tags = "渲染机管理")
public class RenderWorkerController {

    @Autowired
    private RenderWorkerService renderWorkerService;

    @ApiOperation("分页查询渲染机")
    @PostMapping("/page")
    public ApiResponse pageQuery(@RequestBody RenderWorkerReqQuery renderWorkerReqQuery){
        return renderWorkerService.pageQuery(renderWorkerReqQuery);
    }
    @ApiOperation("渲染机列表查询")
    @PostMapping("/list")
    public ApiResponse list(@RequestBody RenderWorkerReqQuery renderWorkerReqQuery){
        return renderWorkerService.list(renderWorkerReqQuery);
    }
    @ApiOperation("渲染机详情查询")
    @GetMapping("/detail/{id}")
    public ApiResponse detail(@PathVariable Long id){
        return renderWorkerService.detail(id);
    }

    @ApiOperation("渲染机新增")
    @PostMapping("/add")
    public ApiResponse add(@RequestBody RenderWorkerEntity renderWorker){
        return renderWorkerService.add(renderWorker);
    }

    @ApiOperation("渲染机删除")
    @DeleteMapping("/delete/{id}")
    public ApiResponse deleteById(@PathVariable Long id){
        return renderWorkerService.deleteById(id);
    }

    @ApiOperation("渲染机修改")
    @PostMapping("/update")
    public ApiResponse update(@RequestBody RenderWorkerEntity renderWorker){
        return renderWorkerService.update(renderWorker);
    }

    @ApiOperation("渲染机修改状态")
    @PutMapping("/updateStatus/{id}")
    public ApiResponse updateStatus(@PathVariable Long id) {
        return renderWorkerService.updateStatus(id);
    }
}
