/**
 * 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 {
  addDecoderSizePrefix,
  addEncoderSizePrefix,
  combineCodec,
  fixDecoderSize,
  fixEncoderSize,
  getAddressDecoder,
  getAddressEncoder,
  getBytesDecoder,
  getBytesEncoder,
  getStructDecoder,
  getStructEncoder,
  getU32Decoder,
  getU32Encoder,
  getU64Decoder,
  getU64Encoder,
  type Address,
  type Codec,
  type Decoder,
  type Encoder,
  type ReadonlyUint8Array,
} from "@solana/kit";

export type FundsDeposited = {
  inputToken: Address;
  outputToken: Address;
  inputAmount: bigint;
  outputAmount: ReadonlyUint8Array;
  destinationChainId: bigint;
  depositId: ReadonlyUint8Array;
  quoteTimestamp: number;
  fillDeadline: number;
  exclusivityDeadline: number;
  depositor: Address;
  recipient: Address;
  exclusiveRelayer: Address;
  message: ReadonlyUint8Array;
};

export type FundsDepositedArgs = {
  inputToken: Address;
  outputToken: Address;
  inputAmount: number | bigint;
  outputAmount: ReadonlyUint8Array;
  destinationChainId: number | bigint;
  depositId: ReadonlyUint8Array;
  quoteTimestamp: number;
  fillDeadline: number;
  exclusivityDeadline: number;
  depositor: Address;
  recipient: Address;
  exclusiveRelayer: Address;
  message: ReadonlyUint8Array;
};

export function getFundsDepositedEncoder(): Encoder<FundsDepositedArgs> {
  return getStructEncoder([
    ["inputToken", getAddressEncoder()],
    ["outputToken", getAddressEncoder()],
    ["inputAmount", getU64Encoder()],
    ["outputAmount", fixEncoderSize(getBytesEncoder(), 32)],
    ["destinationChainId", getU64Encoder()],
    ["depositId", fixEncoderSize(getBytesEncoder(), 32)],
    ["quoteTimestamp", getU32Encoder()],
    ["fillDeadline", getU32Encoder()],
    ["exclusivityDeadline", getU32Encoder()],
    ["depositor", getAddressEncoder()],
    ["recipient", getAddressEncoder()],
    ["exclusiveRelayer", getAddressEncoder()],
    ["message", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
  ]);
}

export function getFundsDepositedDecoder(): Decoder<FundsDeposited> {
  return getStructDecoder([
    ["inputToken", getAddressDecoder()],
    ["outputToken", getAddressDecoder()],
    ["inputAmount", getU64Decoder()],
    ["outputAmount", fixDecoderSize(getBytesDecoder(), 32)],
    ["destinationChainId", getU64Decoder()],
    ["depositId", fixDecoderSize(getBytesDecoder(), 32)],
    ["quoteTimestamp", getU32Decoder()],
    ["fillDeadline", getU32Decoder()],
    ["exclusivityDeadline", getU32Decoder()],
    ["depositor", getAddressDecoder()],
    ["recipient", getAddressDecoder()],
    ["exclusiveRelayer", getAddressDecoder()],
    ["message", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
  ]);
}

export function getFundsDepositedCodec(): Codec<
  FundsDepositedArgs,
  FundsDeposited
> {
  return combineCodec(getFundsDepositedEncoder(), getFundsDepositedDecoder());
}
