/** * 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, getArrayDecoder, getArrayEncoder, getMapDecoder, getMapEncoder, getStructDecoder, getStructEncoder, type Codec, type Decoder, type Encoder, } from '@solana/kit'; import { getFactionDecoder, getFactionEncoder, type Faction, type FactionArgs, } from '@staratlas/dev-profile-faction'; import { getBoundingBoxDecoder, getBoundingBoxEncoder, getNameDecoder, getNameEncoder, getRegionIdDecoder, getRegionIdEncoder, getResearchTagDecoder, getResearchTagEncoder, getRiskZoneDecoder, getRiskZoneEncoder, getSafetyStatusDecoder, getSafetyStatusEncoder, getSystemIdDecoder, getSystemIdEncoder, type BoundingBox, type BoundingBoxArgs, type Name, type NameArgs, type RegionId, type RegionIdArgs, type ResearchTag, type ResearchTagArgs, type RiskZone, type RiskZoneArgs, type SafetyStatus, type SafetyStatusArgs, type SystemId, type SystemIdArgs, } from '.'; import { getI8F56Decoder, getI8F56Encoder, getU16F16Decoder, getU16F16Encoder, type I8F56, type I8F56Args, type U16F16, type U16F16Args, } from '../../fixed/codecs'; /** A single Region */ export type Region = { /** The id of this region */ id: RegionId; /** The name of this region */ name: Name; /** The faction that owns this region */ owner: Faction; /** Whether this region currently resolves to an effective low-risk zone. */ safetyStatus: SafetyStatus; /** A pre-calculated bounding box for this region for fast spatial queries. */ boundingBox: BoundingBox; /** The xp modifier for this region */ xpModifier: U16F16; riskZone: RiskZone; /** the border of this region */ border: Array>; /** per-edge neighbor mapping aligned with `border` (0 = deep space) */ neighborsByEdge: Array; /** Regions connected by at least one cross-region system warp lane. */ connections: Array; /** the systems in this region */ systems: Map; /** the core systems of this region */ coreSystems: Map; /** the research requirements for scanning */ scanningResearchRequirements: Array; /** the research requirements for mining */ miningResearchRequirements: Array; }; export type RegionArgs = { /** The id of this region */ id: RegionIdArgs; /** The name of this region */ name: NameArgs; /** The faction that owns this region */ owner: FactionArgs; /** Whether this region currently resolves to an effective low-risk zone. */ safetyStatus: SafetyStatusArgs; /** A pre-calculated bounding box for this region for fast spatial queries. */ boundingBox: BoundingBoxArgs; /** The xp modifier for this region */ xpModifier: U16F16Args; riskZone: RiskZoneArgs; /** the border of this region */ border: Array>; /** per-edge neighbor mapping aligned with `border` (0 = deep space) */ neighborsByEdge: Array; /** Regions connected by at least one cross-region system warp lane. */ connections: Array; /** the systems in this region */ systems: Map; /** the core systems of this region */ coreSystems: Map; /** the research requirements for scanning */ scanningResearchRequirements: Array; /** the research requirements for mining */ miningResearchRequirements: Array; }; export function getRegionEncoder(): Encoder { return getStructEncoder([ ['id', getRegionIdEncoder()], ['name', getNameEncoder()], ['owner', getFactionEncoder()], ['safetyStatus', getSafetyStatusEncoder()], ['boundingBox', getBoundingBoxEncoder()], ['xpModifier', getU16F16Encoder()], ['riskZone', getRiskZoneEncoder()], [ 'border', getArrayEncoder(getArrayEncoder(getI8F56Encoder(), { size: 2 })), ], ['neighborsByEdge', getArrayEncoder(getRegionIdEncoder())], ['connections', getArrayEncoder(getRegionIdEncoder())], ['systems', getMapEncoder(getSystemIdEncoder(), getFactionEncoder())], ['coreSystems', getMapEncoder(getSystemIdEncoder(), getFactionEncoder())], ['scanningResearchRequirements', getArrayEncoder(getResearchTagEncoder())], ['miningResearchRequirements', getArrayEncoder(getResearchTagEncoder())], ]); } export function getRegionDecoder(): Decoder { return getStructDecoder([ ['id', getRegionIdDecoder()], ['name', getNameDecoder()], ['owner', getFactionDecoder()], ['safetyStatus', getSafetyStatusDecoder()], ['boundingBox', getBoundingBoxDecoder()], ['xpModifier', getU16F16Decoder()], ['riskZone', getRiskZoneDecoder()], [ 'border', getArrayDecoder(getArrayDecoder(getI8F56Decoder(), { size: 2 })), ], ['neighborsByEdge', getArrayDecoder(getRegionIdDecoder())], ['connections', getArrayDecoder(getRegionIdDecoder())], ['systems', getMapDecoder(getSystemIdDecoder(), getFactionDecoder())], ['coreSystems', getMapDecoder(getSystemIdDecoder(), getFactionDecoder())], ['scanningResearchRequirements', getArrayDecoder(getResearchTagDecoder())], ['miningResearchRequirements', getArrayDecoder(getResearchTagDecoder())], ]); } export function getRegionCodec(): Codec { return combineCodec(getRegionEncoder(), getRegionDecoder()); }