package com.cool.store.controller.webc;

import com.cool.store.entity.LeaseBaseInfoDO;
import com.cool.store.request.TrainingExperienceChangeRequest;
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.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/mini/training/experience/")
@Api(tags = "移动端-实训体验")
@Slf4j
public class MiniTrainingExperienceController {

    @Resource
    TrainingExperienceService trainingExperienceService;

    @ApiOperation("实训体验状态变更")
    @PostMapping("/experience/change")
    public ResponseResult experienceStatusChange(@RequestBody TrainingExperienceChangeRequest request) {
        trainingExperienceService.experienceStatusChange(request.getLineId(), request.getStatusEnum().getExperienceStatus(), request.getAbandonCause());
        return ResponseResult.success();
    }

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



}
