/**
 * 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 CreateInstanceEvent = {
  eventDiscriminator: number;
  instanceSeed: Address;
  admin: Address;
};

export type CreateInstanceEventArgs = CreateInstanceEvent;

export function getCreateInstanceEventEncoder(): FixedSizeEncoder<CreateInstanceEventArgs> {
  return getStructEncoder([
    ["eventDiscriminator", getU8Encoder()],
    ["instanceSeed", getAddressEncoder()],
    ["admin", getAddressEncoder()],
  ]);
}

export function getCreateInstanceEventDecoder(): FixedSizeDecoder<CreateInstanceEvent> {
  return getStructDecoder([
    ["eventDiscriminator", getU8Decoder()],
    ["instanceSeed", getAddressDecoder()],
    ["admin", getAddressDecoder()],
  ]);
}

export function getCreateInstanceEventCodec(): FixedSizeCodec<
  CreateInstanceEventArgs,
  CreateInstanceEvent
> {
  return combineCodec(
    getCreateInstanceEventEncoder(),
    getCreateInstanceEventDecoder(),
  );
}
