/**
 * 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, getI64Decoder, getI64Encoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/kit';

export type WithdrawalCaps = { configCapacity: bigint; currentTotal: bigint; lastIntervalStartTimestamp: bigint; configIntervalLengthSeconds: bigint;  };

export type WithdrawalCapsArgs = { configCapacity: number | bigint; currentTotal: number | bigint; lastIntervalStartTimestamp: number | bigint; configIntervalLengthSeconds: number | bigint;  };

export function getWithdrawalCapsEncoder(): FixedSizeEncoder<WithdrawalCapsArgs> {
    return getStructEncoder([['configCapacity', getI64Encoder()], ['currentTotal', getI64Encoder()], ['lastIntervalStartTimestamp', getU64Encoder()], ['configIntervalLengthSeconds', getU64Encoder()]]);
}

export function getWithdrawalCapsDecoder(): FixedSizeDecoder<WithdrawalCaps> {
    return getStructDecoder([['configCapacity', getI64Decoder()], ['currentTotal', getI64Decoder()], ['lastIntervalStartTimestamp', getU64Decoder()], ['configIntervalLengthSeconds', getU64Decoder()]]);
}

export function getWithdrawalCapsCodec(): FixedSizeCodec<WithdrawalCapsArgs, WithdrawalCaps> {
    return combineCodec(getWithdrawalCapsEncoder(), getWithdrawalCapsDecoder());
}