package com.corewing.app.modules.app;

import com.corewing.app.common.Result;
import com.corewing.app.common.annotation.CommonLog;
import com.corewing.app.dto.DeviceActivationRequest;
import com.corewing.app.service.BizDeviceActivationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 产品激活接口
 */
@Api(tags = "产品激活")
@RestController
@RequestMapping("/api/app/device")
public class AppDeviceController {

    @Resource
    private BizDeviceActivationService activationService;

    @CommonLog("激活设备")
    @ApiOperation("激活接口")
    @PostMapping("activation")
    public Result<Boolean> activation(@RequestBody DeviceActivationRequest deviceActivationRequest) {
        return Result.success(activationService.activation(deviceActivationRequest));
    }

    @CommonLog("工厂激活设备")
    @ApiOperation("工厂激活设备")
    @PostMapping("factoryActivation")
    public Result<Boolean> factoryActivation(@RequestBody DeviceActivationRequest deviceActivationRequest) {
        return Result.success(activationService.factoryActivation(deviceActivationRequest));
    }


}
