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

export type Observation = { blockTimestamp: number; sqrtPriceX64: bigint; cumulativeTimePriceX64: bigint; padding: bigint;  };

export type ObservationArgs = { blockTimestamp: number; sqrtPriceX64: number | bigint; cumulativeTimePriceX64: number | bigint; padding: number | bigint;  };

export function getObservationEncoder(): FixedSizeEncoder<ObservationArgs> {
    return getStructEncoder([['blockTimestamp', getU32Encoder()], ['sqrtPriceX64', getU128Encoder()], ['cumulativeTimePriceX64', getU128Encoder()], ['padding', getU128Encoder()]]);
}

export function getObservationDecoder(): FixedSizeDecoder<Observation> {
    return getStructDecoder([['blockTimestamp', getU32Decoder()], ['sqrtPriceX64', getU128Decoder()], ['cumulativeTimePriceX64', getU128Decoder()], ['padding', getU128Decoder()]]);
}

export function getObservationCodec(): FixedSizeCodec<ObservationArgs, Observation> {
    return combineCodec(getObservationEncoder(), getObservationDecoder());
}