import { abis } from "@bosonprotocol/common";
import { Interface } from "@ethersproject/abi";
import { createSellerArgsToStruct } from "../accounts/interface";
import { createOfferArgsToStructs } from "../offers/interface";
import { fullOfferArgsToStruct } from "../exchanges/interface";
import { conditionArgsToStructs } from "../groups/interface";
export const bosonOrchestrationHandlerIface = new Interface(abis.IBosonOrchestrationHandlerABI);
export function encodeCreateSellerAndOffer(seller, collectionSalt, offer) {
    const sellerArgs = createSellerArgsToStruct(seller, collectionSalt);
    const offerArgs = createOfferArgsToStructs(offer);
    return bosonOrchestrationHandlerIface.encodeFunctionData("createSellerAndOffer", [
        sellerArgs.sellerStruct,
        offerArgs[0], // offer
        offerArgs[1], // offerDates
        offerArgs[2], // offerDurations
        offerArgs[3], // disputeResolverId
        sellerArgs.authTokenStruct,
        sellerArgs.voucherInitValues,
        offerArgs[4], // agentId
        offerArgs[5] // feeLimit
    ]);
}
export function encodeCreateOfferWithCondition(offer, condition) {
    const offerArgs = createOfferArgsToStructs(offer);
    return bosonOrchestrationHandlerIface.encodeFunctionData("createOfferWithCondition", [
        offerArgs[0], // offer
        offerArgs[1], // offerDates
        offerArgs[2], // offerDurations
        offerArgs[3], // disputeResolverId
        conditionArgsToStructs(condition),
        offerArgs[4], // agentId
        offerArgs[5] // feeLimit
    ]);
}
export function encodeCreateSellerAndOfferWithCondition(seller, collectionSalt, offer, condition) {
    const sellerArgs = createSellerArgsToStruct(seller, collectionSalt);
    const offerArgs = createOfferArgsToStructs(offer);
    return bosonOrchestrationHandlerIface.encodeFunctionData("createSellerAndOfferWithCondition", [
        sellerArgs.sellerStruct,
        offerArgs[0], // offer
        offerArgs[1], // offerDates
        offerArgs[2], // offerDurations
        offerArgs[3], // disputeResolverId
        conditionArgsToStructs(condition),
        sellerArgs.authTokenStruct,
        sellerArgs.voucherInitValues,
        offerArgs[4], // agentId
        offerArgs[5] // feeLimit
    ]);
}
export function encodeCreatePremintedOfferAddToGroup(offer, premintParameters, groupId) {
    const offerArgs = createOfferArgsToStructs(offer);
    return bosonOrchestrationHandlerIface.encodeFunctionData("createPremintedOfferAddToGroup", [
        offerArgs[0], // offer
        offerArgs[1], // offerDates
        offerArgs[2], // offerDurations
        offerArgs[3], // disputeResolverId
        premintParameters,
        groupId,
        offerArgs[4], // agentId
        offerArgs[5] // feeLimit
    ]);
}
export function encodeCreatePremintedOfferWithCondition(offer, premintParameters, condition) {
    const offerArgs = createOfferArgsToStructs(offer);
    return bosonOrchestrationHandlerIface.encodeFunctionData("createPremintedOfferWithCondition", [
        offerArgs[0], // offer
        offerArgs[1], // offerDates
        offerArgs[2], // offerDurations
        offerArgs[3], // disputeResolverId
        premintParameters,
        conditionArgsToStructs(condition),
        offerArgs[4], // agentId
        offerArgs[5] // feeLimit
    ]);
}
export function encodeCreateSellerAndPremintedOffer(seller, collectionSalt, offer, premintParameters) {
    const sellerArgs = createSellerArgsToStruct(seller, collectionSalt);
    const offerArgs = createOfferArgsToStructs(offer);
    return bosonOrchestrationHandlerIface.encodeFunctionData("createSellerAndPremintedOffer", [
        sellerArgs.sellerStruct,
        offerArgs[0], // offer
        offerArgs[1], // offerDates
        offerArgs[2], // offerDurations
        offerArgs[3], // disputeResolverId
        premintParameters,
        sellerArgs.authTokenStruct,
        sellerArgs.voucherInitValues,
        offerArgs[4], // agentId
        offerArgs[5] // feeLimit
    ]);
}
export function encodeCreateSellerAndPremintedOfferWithCondition(seller, collectionSalt, offer, premintParameters, condition) {
    const sellerArgs = createSellerArgsToStruct(seller, collectionSalt);
    const offerArgs = createOfferArgsToStructs(offer);
    return bosonOrchestrationHandlerIface.encodeFunctionData("createSellerAndPremintedOfferWithCondition", [
        sellerArgs.sellerStruct,
        offerArgs[0], // offer
        offerArgs[1], // offerDates
        offerArgs[2], // offerDurations
        offerArgs[3], // disputeResolverId
        premintParameters,
        conditionArgsToStructs(condition),
        sellerArgs.authTokenStruct,
        sellerArgs.voucherInitValues,
        offerArgs[4], // agentId
        offerArgs[5] // feeLimit
    ]);
}
export function encodeRaiseAndEscalateDispute(exchangeId) {
    return bosonOrchestrationHandlerIface.encodeFunctionData("raiseAndEscalateDispute", [exchangeId]);
}
export function encodeCommitToOfferAndRedeemVoucher(offerId) {
    return bosonOrchestrationHandlerIface.encodeFunctionData("commitToOfferAndRedeemVoucher", [offerId]);
}
export function encodeCommitToConditionalOfferAndRedeemVoucher(offerId, tokenId) {
    return bosonOrchestrationHandlerIface.encodeFunctionData("commitToConditionalOfferAndRedeemVoucher", [offerId, tokenId]);
}
export function encodeCreateOfferCommitAndRedeem(args) {
    return bosonOrchestrationHandlerIface.encodeFunctionData("createOfferCommitAndRedeem", [
        fullOfferArgsToStruct(args),
        args.offerCreator,
        args.signature,
        args.conditionalTokenId || "0"
    ]);
}
//# sourceMappingURL=interface.js.map