/**
 * This code was AUTOGENERATED using the Codama library.
 * Please DO NOT EDIT THIS FILE, instead use visitors
 * to add features, then rerun Codama to update it.
 *
 * @see https://github.com/codama-idl/codama
 */

import {
  combineCodec,
  getBooleanDecoder,
  getBooleanEncoder,
  getStructDecoder,
  getStructEncoder,
  getU64Decoder,
  getU64Encoder,
  type FixedSizeCodec,
  type FixedSizeDecoder,
  type FixedSizeEncoder,
} from "@solana/kit";

export type UsedNonceCloseInfo = {
  canCloseAfter: bigint;
  canCloseNow: boolean;
};

export type UsedNonceCloseInfoArgs = {
  canCloseAfter: number | bigint;
  canCloseNow: boolean;
};

export function getUsedNonceCloseInfoEncoder(): FixedSizeEncoder<UsedNonceCloseInfoArgs> {
  return getStructEncoder([
    ["canCloseAfter", getU64Encoder()],
    ["canCloseNow", getBooleanEncoder()],
  ]);
}

export function getUsedNonceCloseInfoDecoder(): FixedSizeDecoder<UsedNonceCloseInfo> {
  return getStructDecoder([
    ["canCloseAfter", getU64Decoder()],
    ["canCloseNow", getBooleanDecoder()],
  ]);
}

export function getUsedNonceCloseInfoCodec(): FixedSizeCodec<
  UsedNonceCloseInfoArgs,
  UsedNonceCloseInfo
> {
  return combineCodec(
    getUsedNonceCloseInfoEncoder(),
    getUsedNonceCloseInfoDecoder(),
  );
}
