package com.red.circle.other.adapter.app.h5;

import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.common.business.dto.cmd.PageUserIdCmd;
import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.order.inner.endpoint.UserFreightRechargeRecordClient;
import com.red.circle.order.inner.endpoint.UserMonthlyRechargeClient;
import com.red.circle.order.inner.endpoint.api.UserMonthlyRechargeClientApi;
import com.red.circle.order.inner.model.dto.MonthlyRechargeSummaryVO;
import com.red.circle.other.app.dto.cmd.material.PropsStoreTypeQryCmd;
import com.red.circle.other.app.dto.h5.MemberActiveDTO;
import com.red.circle.other.app.dto.h5.RechargePageVO;
import com.red.circle.other.app.dto.h5.RechargeSummaryVO;
import com.red.circle.other.app.dto.h5.UserIdentityVO;
import com.red.circle.other.app.service.h5.MemberActiveService;
import com.red.circle.other.app.service.recharge.RechargeUserService;
import com.red.circle.other.app.service.user.user.UserCountService;
import com.red.circle.other.app.service.user.user.UserIdentityService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/app/h5/", produces = MediaType.APPLICATION_JSON_VALUE)
public class MemberActiveController extends BaseController {

    private final MemberActiveService memberActiveService;
    private final UserIdentityService userIdentityService;
    private final RechargeUserService rechargeUserService;

    /**
     * 工会裂变活动列表、
     * @param cmd 包含公参的命令对象
     * @return 工会裂变活动列表的复合对象
     */
    @GetMapping("member-active/list")
    public MemberActiveDTO activeList(AppExtCommand cmd) {
        return memberActiveService.activeList(cmd);
    }

    /**
     * agent 活动
     * @param cmd 包含公参的命令对象
     */
    @PostMapping("member-active/join")
    public void joinActive(AppExtCommand cmd) {
        memberActiveService.joinActive(cmd);
    }

    /**
     * 用户身份信息.
     */
    @GetMapping("/identity")
    public UserIdentityVO getUserIdentity(AppUserIdCmd cmd) {
        return userIdentityService.getUserIdentity(cmd.getUid());
    }

    /**
     * 货运代理分页列表
     */
    @GetMapping("/recharge-page")
    public PageResult<RechargePageVO>  rechargePage(PageUserIdCmd page, AppExtCommand cmd) {
        return rechargeUserService.getRechargePage(page, cmd);
    }

    /**
     * 货运代理充值月度汇总（当月，上月）
     */
    @GetMapping("/recharge-summary")
    public RechargeSummaryVO rechargeSummary(AppExtCommand cmd) {
        return rechargeUserService.getRechargeSummary(cmd);
    }

  /**
   * 是否有指定道具类型的权限
   */
    @GetMapping("/own-permission")
    public Boolean permission(PropsStoreTypeQryCmd cmd) {
      return userIdentityService.hasPermission(cmd);
    }

}
