/**
 * 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, getU128Decoder, getU128Encoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/kit';

export type RewardInfo = { 
/** Reward state */
rewardState: number; 
/** Reward open time */
openTime: bigint; 
/** Reward end time */
endTime: bigint; 
/** Reward last update time */
lastUpdateTime: bigint; 
/** Q64.64 number indicates how many tokens per second are earned per unit of liquidity. */
emissionsPerSecondX64: bigint; 
/** The total amount of reward emissioned */
rewardTotalEmissioned: bigint; 
/** The total amount of claimed reward */
rewardClaimed: bigint; 
/** Reward token mint. */
tokenMint: Address; 
/** Reward vault token account. */
tokenVault: Address; 
/** The owner that has permission to set reward param */
authority: Address; 
/**
 * Q64.64 number that tracks the total tokens earned per unit of liquidity since the reward
 * emissions were turned on.
 */
rewardGrowthGlobalX64: bigint;  };

export type RewardInfoArgs = { 
/** Reward state */
rewardState: number; 
/** Reward open time */
openTime: number | bigint; 
/** Reward end time */
endTime: number | bigint; 
/** Reward last update time */
lastUpdateTime: number | bigint; 
/** Q64.64 number indicates how many tokens per second are earned per unit of liquidity. */
emissionsPerSecondX64: number | bigint; 
/** The total amount of reward emissioned */
rewardTotalEmissioned: number | bigint; 
/** The total amount of claimed reward */
rewardClaimed: number | bigint; 
/** Reward token mint. */
tokenMint: Address; 
/** Reward vault token account. */
tokenVault: Address; 
/** The owner that has permission to set reward param */
authority: Address; 
/**
 * Q64.64 number that tracks the total tokens earned per unit of liquidity since the reward
 * emissions were turned on.
 */
rewardGrowthGlobalX64: number | bigint;  };

export function getRewardInfoEncoder(): FixedSizeEncoder<RewardInfoArgs> {
    return getStructEncoder([['rewardState', getU8Encoder()], ['openTime', getU64Encoder()], ['endTime', getU64Encoder()], ['lastUpdateTime', getU64Encoder()], ['emissionsPerSecondX64', getU128Encoder()], ['rewardTotalEmissioned', getU64Encoder()], ['rewardClaimed', getU64Encoder()], ['tokenMint', getAddressEncoder()], ['tokenVault', getAddressEncoder()], ['authority', getAddressEncoder()], ['rewardGrowthGlobalX64', getU128Encoder()]]);
}

export function getRewardInfoDecoder(): FixedSizeDecoder<RewardInfo> {
    return getStructDecoder([['rewardState', getU8Decoder()], ['openTime', getU64Decoder()], ['endTime', getU64Decoder()], ['lastUpdateTime', getU64Decoder()], ['emissionsPerSecondX64', getU128Decoder()], ['rewardTotalEmissioned', getU64Decoder()], ['rewardClaimed', getU64Decoder()], ['tokenMint', getAddressDecoder()], ['tokenVault', getAddressDecoder()], ['authority', getAddressDecoder()], ['rewardGrowthGlobalX64', getU128Decoder()]]);
}

export function getRewardInfoCodec(): FixedSizeCodec<RewardInfoArgs, RewardInfo> {
    return combineCodec(getRewardInfoEncoder(), getRewardInfoDecoder());
}