import { CandyMachineClient } from './CandyMachineClient.mjs';
import { candyMachineProgram, defaultCandyGuardProgram, gatewayProgram } from './programs.mjs';
import { botTaxGuardManifest } from './guards/botTax.mjs';
import { solPaymentGuardManifest } from './guards/solPayment.mjs';
import { tokenPaymentGuardManifest } from './guards/tokenPayment.mjs';
import { startDateGuardManifest } from './guards/startDate.mjs';
import { thirdPartySignerGuardManifest } from './guards/thirdPartySigner.mjs';
import { tokenGateGuardManifest } from './guards/tokenGate.mjs';
import { gatekeeperGuardManifest } from './guards/gatekeeper.mjs';
import { endDateGuardManifest } from './guards/endDate.mjs';
import { allowListGuardManifest } from './guards/allowList.mjs';
import { mintLimitGuardManifest } from './guards/mintLimit.mjs';
import { nftPaymentGuardManifest } from './guards/nftPayment.mjs';
import { redeemedAmountGuardManifest } from './guards/redeemedAmount.mjs';
import { addressGateGuardManifest } from './guards/addressGate.mjs';
import { nftGateGuardManifest } from './guards/nftGate.mjs';
import { nftBurnGuardManifest } from './guards/nftBurn.mjs';
import { tokenBurnGuardManifest } from './guards/tokenBurn.mjs';
import { callCandyGuardRouteOperation, callCandyGuardRouteOperationHandler } from './operations/callCandyGuardRoute.mjs';
import { createCandyGuardOperation, createCandyGuardOperationHandler } from './operations/createCandyGuard.mjs';
import { createCandyMachineOperation, createCandyMachineOperationHandler } from './operations/createCandyMachine.mjs';
import { deleteCandyGuardOperation, deleteCandyGuardOperationHandler } from './operations/deleteCandyGuard.mjs';
import { deleteCandyMachineOperation, deleteCandyMachineOperationHandler } from './operations/deleteCandyMachine.mjs';
import { findCandyGuardByAddressOperation, findCandyGuardByAddressOperationHandler } from './operations/findCandyGuardByAddress.mjs';
import { findCandyGuardsByAuthorityOperation, findCandyGuardsByAuthorityOperationHandler } from './operations/findCandyGuardsByAuthority.mjs';
import { findCandyMachineByAddressOperation, findCandyMachineByAddressOperationHandler } from './operations/findCandyMachineByAddress.mjs';
import { insertCandyMachineItemsOperation, insertCandyMachineItemsOperationHandler } from './operations/insertCandyMachineItems.mjs';
import { mintFromCandyMachineOperation, mintFromCandyMachineOperationHandler } from './operations/mintFromCandyMachine.mjs';
import { unwrapCandyGuardOperation, unwrapCandyGuardOperationHandler } from './operations/unwrapCandyGuard.mjs';
import { updateCandyGuardOperation, updateCandyGuardOperationHandler } from './operations/updateCandyGuard.mjs';
import { updateCandyMachineOperation, updateCandyMachineOperationHandler } from './operations/updateCandyMachine.mjs';
import { wrapCandyGuardOperation, wrapCandyGuardOperationHandler } from './operations/wrapCandyGuard.mjs';

/** @group Plugins */
const candyMachineModule = () => ({
  install(metaplex) {
    // Client.
    const client = new CandyMachineClient(metaplex);
    metaplex.candyMachines = () => client;

    // Candy Machine Program.
    metaplex.programs().register(candyMachineProgram);
    metaplex.programs().getCandyMachine = function (programs) {
      return this.get(candyMachineProgram.name, programs);
    };

    // Candy Guard Program.
    metaplex.programs().register(defaultCandyGuardProgram);
    metaplex.programs().getCandyGuard = function (programs) {
      return this.get(defaultCandyGuardProgram.name, programs);
    };

    // Gateway Program.
    metaplex.programs().register(gatewayProgram);
    metaplex.programs().getGateway = function (programs) {
      return this.get(gatewayProgram.name, programs);
    };

    // Default Guards.
    client.guards().register(botTaxGuardManifest);
    client.guards().register(solPaymentGuardManifest);
    client.guards().register(tokenPaymentGuardManifest);
    client.guards().register(startDateGuardManifest);
    client.guards().register(thirdPartySignerGuardManifest);
    client.guards().register(tokenGateGuardManifest);
    client.guards().register(gatekeeperGuardManifest);
    client.guards().register(endDateGuardManifest);
    client.guards().register(allowListGuardManifest);
    client.guards().register(mintLimitGuardManifest);
    client.guards().register(nftPaymentGuardManifest);
    client.guards().register(redeemedAmountGuardManifest);
    client.guards().register(addressGateGuardManifest);
    client.guards().register(nftGateGuardManifest);
    client.guards().register(nftBurnGuardManifest);
    client.guards().register(tokenBurnGuardManifest);

    // Operations.
    const op = metaplex.operations();
    op.register(callCandyGuardRouteOperation, callCandyGuardRouteOperationHandler);
    op.register(createCandyGuardOperation, createCandyGuardOperationHandler);
    op.register(createCandyMachineOperation, createCandyMachineOperationHandler);
    op.register(deleteCandyGuardOperation, deleteCandyGuardOperationHandler);
    op.register(deleteCandyMachineOperation, deleteCandyMachineOperationHandler);
    op.register(findCandyGuardByAddressOperation, findCandyGuardByAddressOperationHandler);
    op.register(findCandyGuardsByAuthorityOperation, findCandyGuardsByAuthorityOperationHandler);
    op.register(findCandyMachineByAddressOperation, findCandyMachineByAddressOperationHandler);
    op.register(insertCandyMachineItemsOperation, insertCandyMachineItemsOperationHandler);
    op.register(mintFromCandyMachineOperation, mintFromCandyMachineOperationHandler);
    op.register(unwrapCandyGuardOperation, unwrapCandyGuardOperationHandler);
    op.register(updateCandyGuardOperation, updateCandyGuardOperationHandler);
    op.register(updateCandyMachineOperation, updateCandyMachineOperationHandler);
    op.register(wrapCandyGuardOperation, wrapCandyGuardOperationHandler);
  }
});

export { candyMachineModule };
//# sourceMappingURL=plugin.mjs.map
