/**
 * 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, getI32Decoder, getI32Encoder, getOptionDecoder, getOptionEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, type Codec, type Decoder, type Encoder, type Option, type OptionOrNullable } from '@solana/kit';
import { getPriceDecoder, getPriceEncoder, type Price, type PriceArgs } from '.';

export type RebalanceAutodriftWindow = { stakingRateA: Option<Price>; stakingRateB: Option<Price>; epoch: bigint; theoreticalTick: number; stratMidTick: number;  };

export type RebalanceAutodriftWindowArgs = { stakingRateA: OptionOrNullable<PriceArgs>; stakingRateB: OptionOrNullable<PriceArgs>; epoch: number | bigint; theoreticalTick: number; stratMidTick: number;  };

export function getRebalanceAutodriftWindowEncoder(): Encoder<RebalanceAutodriftWindowArgs> {
    return getStructEncoder([['stakingRateA', getOptionEncoder(getPriceEncoder())], ['stakingRateB', getOptionEncoder(getPriceEncoder())], ['epoch', getU64Encoder()], ['theoreticalTick', getI32Encoder()], ['stratMidTick', getI32Encoder()]]);
}

export function getRebalanceAutodriftWindowDecoder(): Decoder<RebalanceAutodriftWindow> {
    return getStructDecoder([['stakingRateA', getOptionDecoder(getPriceDecoder())], ['stakingRateB', getOptionDecoder(getPriceDecoder())], ['epoch', getU64Decoder()], ['theoreticalTick', getI32Decoder()], ['stratMidTick', getI32Decoder()]]);
}

export function getRebalanceAutodriftWindowCodec(): Codec<RebalanceAutodriftWindowArgs, RebalanceAutodriftWindow> {
    return combineCodec(getRebalanceAutodriftWindowEncoder(), getRebalanceAutodriftWindowDecoder());
}