// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.30;

import {IERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {IPartyPool} from "./IPartyPool.sol";
import {IPartyPoolDeployer} from "./IPartyPoolDeployer.sol";
import {NativeWrapper} from "./NativeWrapper.sol";
import {PartyPool} from "./PartyPool.sol";
import {PartyPoolBalancedPair} from "./PartyPoolBalancedPair.sol";
import {PartyPoolMintImpl} from "./PartyPoolMintImpl.sol";
import {PartyPoolSwapImpl} from "./PartyPoolSwapImpl.sol";

// This pattern is needed because the PartyPlanner constructs two different types of pools (regular and balanced-pair)
// but doesn't have room to store the initialization code of both contracts. Therefore, we delegate pool construction.

abstract contract BasePartyPoolDeployer is IPartyPoolDeployer {
    uint256 private nonce;
    DeployParams public params;

    function deploy(DeployParams memory params_) external returns (IPartyPool pool) {
        params = params_;
        pool = _doDeploy(nonce);
        nonce += 1;
    }

    function _doDeploy(uint256 nonce) virtual internal returns (IPartyPool pool);
}


contract PartyPoolDeployer is BasePartyPoolDeployer {
    function _doDeploy(uint256 nonce) internal override returns (IPartyPool) {
        return new PartyPool(nonce);
    }
}

contract PartyPoolBalancedPairDeployer is BasePartyPoolDeployer {
    function _doDeploy(uint256 nonce) internal override returns (IPartyPool) {
        return new PartyPoolBalancedPair(nonce);
    }
}
