package com.ff.api.controller;


import cn.hutool.core.util.NumberUtil;
import com.ff.annotation.CheckHeader;
import com.ff.api.request.*;
import com.ff.api.response.GameExchangeBalanceResponse;
import com.ff.api.response.TenantInfoResponse;
import com.ff.base.constant.Constants;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.core.page.TableDataInfo;
import com.ff.base.enums.OperationType;
import com.ff.base.enums.TenantQuotaType;
import com.ff.base.enums.TransferType;
import com.ff.base.exception.base.BaseException;
import com.ff.base.utils.StringUtils;
import com.ff.base.utils.bean.BeanUtils;
import com.ff.common.domain.TenantGameQuota;
import com.ff.common.domain.TenantGameQuotaFlow;
import com.ff.common.domain.TenantSecretKey;
import com.ff.common.dto.BalanceChangesDTO;
import com.ff.common.service.ITenantGameQuotaFlowService;
import com.ff.common.service.ITenantGameQuotaService;
import com.ff.config.KeyConfig;
import com.ff.game.api.IGamesService;
import com.ff.game.api.request.*;
import com.ff.game.domain.*;
import com.ff.game.service.*;
import com.ff.member.domain.Member;
import com.ff.member.service.IMemberService;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
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;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;

/**
 * api控制器
 *
 * @author shi
 * @date 2025/02/10
 */
@RestController
@CheckHeader
@RequestMapping("/api/tenant")
@Slf4j
public class ApiTenantController extends BaseController {


    @Resource
    private ITenantGameQuotaService tenantGameQuotaService;
    @Resource
    private KeyConfig keyConfig;

    /**
     * 信息
     *
     * @return {@link AjaxResult }
     */
    @PostMapping("/info")
    public AjaxResult info() {
        TenantSecretKey tenantSecretKey = keyConfig.get();
        TenantGameQuota tenantGameQuota = tenantGameQuotaService.selectTenantGameQuotaByTenantKey(tenantSecretKey.getTenantKey(), TenantQuotaType.BALANCE.getCode());
        TenantInfoResponse tenantInfoResponse= new TenantInfoResponse();
        BeanUtils.copyProperties(tenantGameQuota,tenantInfoResponse);
        return AjaxResult.success(tenantInfoResponse);
    }

}
