package com.fdkankan.platform.user.controller.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fdkankan.platform.user.request.RequestUserIncrement;
import com.fdkankan.platform.user.service.IUserIncrementService;
import com.fdkankan.platform.user.vo.ResponseUserIncrement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 个人中心-增值权益
 */
@RestController
@RequestMapping("/service/platform/user/increment")
public class UserIncrementController {

    private static Logger log = LoggerFactory.getLogger("programLog");

    @Autowired
    private IUserIncrementService userIncrementService;


    /**
     * 获取用户的增值权益包列表
     * snCode      相机sn查询
     * pageNum     分页
     * pageSize   每页大小
     * @return
     */
    @RequestMapping(value = "/findIncrementList", method = RequestMethod.POST)
    public Page<ResponseUserIncrement> findIncrementList(RequestUserIncrement param, @RequestHeader String token) throws Exception {
        return userIncrementService.findIncrementList(param,token);
    }

    /**
     * 绑定增值权益包
     * id       权益包id
     * snCode   相机sn查询
     */
    @RequestMapping(value = "/bindCamera", method = RequestMethod.POST)
    public String bindCamera(@RequestBody RequestUserIncrement param, @RequestHeader String token) throws Exception {
        return userIncrementService.bindCamera(param,token);
    }

    /**
     * 根据id查询权益信息
     * id      权益包id
     */
    @RequestMapping(value = "/unbindCamera", method = RequestMethod.POST)
    public String unbindCamera(@RequestBody RequestUserIncrement param, @RequestHeader String token) throws Exception {
        return userIncrementService.unbindCamera(param,token);
    }

    /**
     * 根据id查询权益信息
     * id          权益id
     */
    @RequestMapping(value = "/findById", method = RequestMethod.POST)
    public ResponseUserIncrement findById(@RequestBody RequestUserIncrement param, @RequestHeader String token) throws Exception {
        return userIncrementService.findById(param,token);
    }

}
