package com.bizzan.bitrade.service;

import java.math.BigDecimal;

import org.springframework.transaction.annotation.Transactional;

import com.bizzan.bitrade.entity.ContractCoin;
import com.bizzan.bitrade.entity.IWallet;

public interface WalletService {

	boolean freezeMarginAndFee(Long id, ContractCoin contractCoin, BigDecimal amount);

	/**
	 * 批量直接开仓专用：将保证金和手续费从 balance 直接冻结到 frozen_balance，跳过 frozen_margin 中转。
	 * balance -= (principal + fee)，frozen_balance += principal，fee 直接消耗（划转平台收入）。
	 */
	boolean freezeMarginDirectly(Long id, ContractCoin coin, BigDecimal principal, BigDecimal fee);

	boolean freezeMarginDirectly(Long id, ContractCoin coin, BigDecimal principal, BigDecimal fee, Long openTime);

	void clearOpenFee(Long id, ContractCoin coin, BigDecimal margin, BigDecimal openFee);

	void clearContractCloseFee(Long id, ContractCoin coin, BigDecimal amount);

	void clearProfitOrLoss(Long id, ContractCoin coin, BigDecimal amount);

	void clearContractOvernightFee(Long id, ContractCoin coin, BigDecimal amount);
	
	void releaseMargin(Long id, BigDecimal amount);
	
	IWallet findOne(Long id);

	void clearContractOvernightFee(Long id, ContractCoin coin, BigDecimal amount, BigDecimal rebateFee);

}