/**
 * 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,
  getEnumDecoder,
  getEnumEncoder,
  getU32Decoder,
  getU32Encoder,
  type FixedSizeCodec,
  type FixedSizeDecoder,
  type FixedSizeEncoder,
} from '@solana/kit';

export enum NonceVersion {
  Legacy,
  Current,
}

export type NonceVersionArgs = NonceVersion;

export function getNonceVersionEncoder(): FixedSizeEncoder<NonceVersionArgs> {
  return getEnumEncoder(NonceVersion, {
    size: getU32Encoder(),
  }) as FixedSizeEncoder<NonceVersionArgs>;
}

export function getNonceVersionDecoder(): FixedSizeDecoder<NonceVersion> {
  return getEnumDecoder(NonceVersion, {
    size: getU32Decoder(),
  }) as FixedSizeDecoder<NonceVersion>;
}

export function getNonceVersionCodec(): FixedSizeCodec<
  NonceVersionArgs,
  NonceVersion
> {
  return combineCodec(
    getNonceVersionEncoder(),
    getNonceVersionDecoder()
  ) as FixedSizeCodec<NonceVersionArgs, NonceVersion>;
}
