package com.bizzan.bitrade.controller.option;

import com.bizzan.bitrade.annotation.AccessLog;
import com.bizzan.bitrade.constant.AdminModule;
import com.bizzan.bitrade.constant.PageModel;
import com.bizzan.bitrade.controller.common.BaseAdminController;
import com.bizzan.bitrade.entity.*;
import com.bizzan.bitrade.model.screen.ContractFinanceScreen;
import com.bizzan.bitrade.util.MessageResult;
import com.bizzan.bitrade.util.PredicateUtils;
import com.querydsl.core.types.Predicate;
import com.querydsl.core.types.dsl.BooleanExpression;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.ArrayList;

@RestController
@RequestMapping("/second")
@Slf4j
public class ContractSecondController extends BaseAdminController {
    /**
     * 查询
     * @param pageModel
     * @param
     * @return
     */
    @RequiresPermissions("second-order:page-query")
    @PostMapping("order/page-query")
    @AccessLog(module = AdminModule.CONTRACTOPTION, operation = "秒合约 列表")
    public MessageResult queryOrders(
            PageModel pageModel) {
        return null;
    }
    /**
     * 查询
     * @param pageModel
     * @param
     * @return
     */
    @RequiresPermissions("set:page-query")
    @PostMapping("set/page-query")
    @AccessLog(module = AdminModule.CONTRACTOPTION, operation = "包赔设置 列表")
    public MessageResult querySets(
            PageModel pageModel) {
        return null;
    }

    private Predicate getPredicate() {
        ArrayList<BooleanExpression> booleanExpressions = new ArrayList<>();
        return PredicateUtils.getPredicate(booleanExpressions);
    }

    /**
     * 添加包赔设置
     * @param contractSecondSet
     * @return
     */
    @RequiresPermissions("second-set:add")
    @PostMapping("set/add")
    @AccessLog(module = AdminModule.CONTRACTOPTION, operation = "添加包赔设置 新增")
    public MessageResult add() {
        return null;
    }

    /**
     * 修改包赔设置
     * @return
     */
    @RequiresPermissions("second-set:alter")
    @PostMapping("set/alter")
    @AccessLog(module = AdminModule.CONTRACTOPTION, operation = "修改包赔设置 修改")
    public MessageResult alter(
            @RequestParam("id") Long id,
            @RequestParam(value = "startTime", required = false) String startTime, // 开始时间
            @RequestParam(value = "endTime", required = false) String endTime, // 结束时间
            @RequestParam(value = "orderNum", required = false) Integer orderNum, // 包赔单数
            @RequestParam(value = "limitRate", required = false) BigDecimal limitRate
    ) {
        return null;
    }

    /**
     * 修改包赔设置
     * @return
     */
    @RequiresPermissions("second-set:del")
    @PostMapping("set/delete")
    @AccessLog(module = AdminModule.CONTRACTOPTION, operation = "包赔设置 删除")
    public MessageResult delete(
            @RequestParam(value = "ids") String[] ids
    ) {
        return null;
    }


    /**
     * 查询
     * @param pageModel
     * @param
     * @return
     */
    @RequiresPermissions("cycle:page-query")
    @PostMapping("cycle/page-query")
    @AccessLog(module = AdminModule.CONTRACTOPTION, operation = "秒合约周期 列表")
    public MessageResult queryCycles(
            PageModel pageModel) {
        return null;
    }

    /**
     * 添加秒合约周期
     * @param contractSecondCycle
     * @return
     */
    @RequiresPermissions("second-cycle:add")
    @PostMapping("cycle/add")
    @AccessLog(module = AdminModule.CONTRACTOPTION, operation = "添加秒合约周期 新增")
    public MessageResult addCycle() {
        return null;
    }

    /**
     * 修改秒合约周期
     * @return
     */
    @RequiresPermissions("second-cycle:alter")
    @PostMapping("cycle/alter")
    @AccessLog(module = AdminModule.CONTRACTOPTION, operation = "修改秒合约周期")
    public MessageResult alterCycle(
            @RequestParam("id") Long id,
            @RequestParam(value = "cycleRate", required = false) BigDecimal cycleRate, // 周期赔率
            @RequestParam(value = "cycleLength", required = false) Long cycleLength, // 周期时长（秒）
            @RequestParam(value = "minAmount", required = false) BigDecimal minAmount, // 最小数量
            @RequestParam(value = "maxAmount", required = false) BigDecimal maxAmount //最大数量
    ) {
        return null;
    }

    /**
     * 删除秒合约周期
     * @return
     */
    @RequiresPermissions("second-cycle:del")
    @PostMapping("cycle/delete")
    @AccessLog(module = AdminModule.CONTRACTOPTION, operation = "秒合约周期 删除")
    public MessageResult delCycle(
            @RequestParam(value = "ids") String[] ids
    ) {
        return null;
    }


    /**
     * 查询 期权账户
     * @param pageModel
     * @param
     * @return
     */
    @RequiresPermissions("second-account:page-query")
    @PostMapping("account/page-query")
    @AccessLog(module = AdminModule.CONTRACTOPTION, operation = "秒合约账户 列表")
    public MessageResult queryAccounts(
            PageModel pageModel, ContractFinanceScreen screen) {
        return null;
    }

}
