"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bosonDisputeHandlerIface = void 0;
exports.encodeDecideDispute = encodeDecideDispute;
exports.encodeEscalateDispute = encodeEscalateDispute;
exports.encodeExpireDispute = encodeExpireDispute;
exports.encodeExpireDisputeBatch = encodeExpireDisputeBatch;
exports.encodeExpireEscalatedDispute = encodeExpireEscalatedDispute;
exports.encodeExtendDisputeTimeout = encodeExtendDisputeTimeout;
exports.encodeRaiseDispute = encodeRaiseDispute;
exports.encodeRefuseEscalatedDispute = encodeRefuseEscalatedDispute;
exports.encodeResolveDispute = encodeResolveDispute;
exports.encodeRetractDispute = encodeRetractDispute;
const common_1 = require("@bosonprotocol/common");
const abi_1 = require("@ethersproject/abi");
const signature_1 = require("../utils/signature");
exports.bosonDisputeHandlerIface = new abi_1.Interface(common_1.abis.IBosonDisputeHandlerABI);
function encodeDecideDispute(args) {
    return exports.bosonDisputeHandlerIface.encodeFunctionData("decideDispute", [
        args.exchangeId,
        args.buyerPercent
    ]);
}
function encodeEscalateDispute(exchangeId) {
    return exports.bosonDisputeHandlerIface.encodeFunctionData("escalateDispute", [
        exchangeId
    ]);
}
function encodeExpireDispute(exchangeId) {
    return exports.bosonDisputeHandlerIface.encodeFunctionData("expireDispute", [
        exchangeId
    ]);
}
function encodeExpireDisputeBatch(exchangeIds) {
    return exports.bosonDisputeHandlerIface.encodeFunctionData("expireDispute", [
        exchangeIds
    ]);
}
function encodeExpireEscalatedDispute(exchangeId) {
    return exports.bosonDisputeHandlerIface.encodeFunctionData("expireEscalatedDispute", [
        exchangeId
    ]);
}
function encodeExtendDisputeTimeout(args) {
    return exports.bosonDisputeHandlerIface.encodeFunctionData("extendDisputeTimeout", [
        args.exchangeId,
        args.newDisputeTimeout
    ]);
}
function encodeRaiseDispute(args) {
    return exports.bosonDisputeHandlerIface.encodeFunctionData("raiseDispute", [
        args.exchangeId
    ]);
}
function encodeRefuseEscalatedDispute(exchangeId) {
    return exports.bosonDisputeHandlerIface.encodeFunctionData("refuseEscalatedDispute", [
        exchangeId
    ]);
}
function encodeResolveDispute(args) {
    let signature;
    if (!("signature" in args)) {
        signature = (0, signature_1.rebuildSignature)({
            r: args.sigR.toString(),
            s: args.sigS.toString(),
            v: Number(args.sigV)
        });
    }
    else {
        signature = args.signature;
    }
    return exports.bosonDisputeHandlerIface.encodeFunctionData("resolveDispute", [
        args.exchangeId,
        args.buyerPercentBasisPoints,
        signature
    ]);
}
function encodeRetractDispute(exchangeId) {
    return exports.bosonDisputeHandlerIface.encodeFunctionData("retractDispute", [
        exchangeId
    ]);
}
//# sourceMappingURL=interface.js.map