/**
 * 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,
  getAddressDecoder,
  getAddressEncoder,
  getStructDecoder,
  getStructEncoder,
  getU8Decoder,
  getU8Encoder,
  type Address,
  type FixedSizeCodec,
  type FixedSizeDecoder,
  type FixedSizeEncoder,
} from "@solana/kit";

export type SetNewAdminEvent = {
  eventDiscriminator: number;
  instanceSeed: Address;
  oldAdmin: Address;
  newAdmin: Address;
};

export type SetNewAdminEventArgs = SetNewAdminEvent;

export function getSetNewAdminEventEncoder(): FixedSizeEncoder<SetNewAdminEventArgs> {
  return getStructEncoder([
    ["eventDiscriminator", getU8Encoder()],
    ["instanceSeed", getAddressEncoder()],
    ["oldAdmin", getAddressEncoder()],
    ["newAdmin", getAddressEncoder()],
  ]);
}

export function getSetNewAdminEventDecoder(): FixedSizeDecoder<SetNewAdminEvent> {
  return getStructDecoder([
    ["eventDiscriminator", getU8Decoder()],
    ["instanceSeed", getAddressDecoder()],
    ["oldAdmin", getAddressDecoder()],
    ["newAdmin", getAddressDecoder()],
  ]);
}

export function getSetNewAdminEventCodec(): FixedSizeCodec<
  SetNewAdminEventArgs,
  SetNewAdminEvent
> {
  return combineCodec(
    getSetNewAdminEventEncoder(),
    getSetNewAdminEventDecoder(),
  );
}
