package com.cool.store.controller.webb;

import com.cool.store.entity.LeaseBaseInfoDO;
import com.cool.store.request.TrainingExperienceDistributionRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.TrainingExperienceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/pc/training/experience/")
@Api(tags = "PC端-实训体验")
@Slf4j
public class PCTrainingExperienceController {

    @Resource
    TrainingExperienceService trainingExperienceService;

    @ApiOperation("实训体验分配或更新")
    @PostMapping("/distribution")
    public ResponseResult<Boolean> distribution(@RequestBody @Validated TrainingExperienceDistributionRequest request) {
        return ResponseResult.success(trainingExperienceService.distribution(request));
    }

    @ApiOperation("查询实训体验")
    @GetMapping("/get")
    public ResponseResult<LeaseBaseInfoDO> getTrainingExperience(@RequestParam("lineId") Long lineId) {
        return ResponseResult.success(trainingExperienceService.getTrainingExperience(lineId));
    }

}
