export type SortingClass =
  | "Default"
  | "Kits"
  | "Tools"
  | "Resources"
  | "Food"
  | "Clothing"
  | "Appliances"
  | "Atmospherics"
  | "Storage"
  | "Ores"
  | "Ices";
export type SlotClass =
  | "None"
  | "Helmet"
  | "Suit"
  | "Back"
  | "GasFilter"
  | "GasCanister"
  | "Motherboard"
  | "Circuitboard"
  | "DataDisk"
  | "Organ"
  | "Ore"
  | "Plant"
  | "Uniform"
  | "Entity"
  | "Battery"
  | "Egg"
  | "Belt"
  | "Tool"
  | "Appliance"
  | "Ingot"
  | "Torpedo"
  | "Cartridge"
  | "AccessCard"
  | "Magazine"
  | "Circuit"
  | "Bottle"
  | "ProgrammableChip"
  | "Glasses"
  | "CreditCard"
  | "DirtCanister"
  | "SensorProcessingUnit"
  | "LiquidCanister"
  | "LiquidBottle"
  | "Wreckage"
  | "SoundCartridge"
  | "DrillHead"
  | "ScanningHead"
  | "Flare"
  | "Blocked";
export type NetworkType =
  | "None"
  | "Pipe"
  | "Power"
  | "Data"
  | "Chute"
  | "Elevator"
  | "PipeLiquid"
  | "LandingPad"
  | "LaunchPad"
  | "PowerAndData"
  | "All";
export type ConnectionRole =
  | "None"
  | "Input"
  | "Input2"
  | "Output"
  | "Output2"
  | "Waste";
export type FieldType = "Read" | "Write" | "ReadWrite";
export type LogicType =
  | "Acceleration"
  | "Activate"
  | "AirRelease"
  | "AlignmentError"
  | "Apex"
  | "AutoLand"
  | "AutoShutOff"
  | "Bpm"
  | "BurnTimeRemaining"
  | "Bypass"
  | "CelestialHash"
  | "CelestialParentHash"
  | "Channel"
  | "Channel0"
  | "Channel1"
  | "Channel2"
  | "Channel3"
  | "Channel4"
  | "Channel5"
  | "Channel6"
  | "Channel7"
  | "Charge"
  | "Chart"
  | "ChartedNavPoints"
  | "ClearMemory"
  | "CollectableGoods"
  | "Color"
  | "Combustion"
  | "CombustionInput"
  | "CombustionInput2"
  | "CombustionLimiter"
  | "CombustionOutput"
  | "CombustionOutput2"
  | "CompletionRatio"
  | "ContactTypeId"
  | "CurrentCode"
  | "CurrentResearchPodType"
  | "Density"
  | "DestinationCode"
  | "Discover"
  | "DistanceAu"
  | "DistanceKm"
  | "DrillCondition"
  | "DryMass"
  | "Eccentricity"
  | "ElevatorLevel"
  | "ElevatorSpeed"
  | "EntityState"
  | "EnvironmentEfficiency"
  | "Error"
  | "ExhaustVelocity"
  | "ExportCount"
  | "ExportQuantity"
  | "ExportSlotHash"
  | "ExportSlotOccupant"
  | "Filtration"
  | "FlightControlRule"
  | "Flush"
  | "ForceWrite"
  | "ForwardX"
  | "ForwardY"
  | "ForwardZ"
  | "Fuel"
  | "Harvest"
  | "Horizontal"
  | "HorizontalRatio"
  | "Idle"
  | "ImportCount"
  | "ImportQuantity"
  | "ImportSlotHash"
  | "ImportSlotOccupant"
  | "Inclination"
  | "Index"
  | "InterrogationProgress"
  | "LineNumber"
  | "Lock"
  | "ManualResearchRequiredPod"
  | "Mass"
  | "Maximum"
  | "MinWattsToContact"
  | "MineablesInQueue"
  | "MineablesInVicinity"
  | "MinedQuantity"
  | "MinimumWattsToContact"
  | "Mode"
  | "NavPoints"
  | "NextWeatherEventTime"
  | "None"
  | "On"
  | "Open"
  | "OperationalTemperatureEfficiency"
  | "OrbitPeriod"
  | "Orientation"
  | "Output"
  | "OverShootTarget"
  | "PassedMoles"
  | "Plant"
  | "PlantEfficiency1"
  | "PlantEfficiency2"
  | "PlantEfficiency3"
  | "PlantEfficiency4"
  | "PlantGrowth1"
  | "PlantGrowth2"
  | "PlantGrowth3"
  | "PlantGrowth4"
  | "PlantHash1"
  | "PlantHash2"
  | "PlantHash3"
  | "PlantHash4"
  | "PlantHealth1"
  | "PlantHealth2"
  | "PlantHealth3"
  | "PlantHealth4"
  | "PositionX"
  | "PositionY"
  | "PositionZ"
  | "Power"
  | "PowerActual"
  | "PowerGeneration"
  | "PowerPotential"
  | "PowerRequired"
  | "PrefabHash"
  | "Pressure"
  | "PressureEfficiency"
  | "PressureExternal"
  | "PressureInput"
  | "PressureInput2"
  | "PressureInternal"
  | "PressureOutput"
  | "PressureOutput2"
  | "PressureSetting"
  | "Progress"
  | "Quantity"
  | "Ratio"
  | "RatioCarbonDioxide"
  | "RatioCarbonDioxideInput"
  | "RatioCarbonDioxideInput2"
  | "RatioCarbonDioxideOutput"
  | "RatioCarbonDioxideOutput2"
  | "RatioHydrogen"
  | "RatioLiquidCarbonDioxide"
  | "RatioLiquidCarbonDioxideInput"
  | "RatioLiquidCarbonDioxideInput2"
  | "RatioLiquidCarbonDioxideOutput"
  | "RatioLiquidCarbonDioxideOutput2"
  | "RatioLiquidHydrogen"
  | "RatioLiquidNitrogen"
  | "RatioLiquidNitrogenInput"
  | "RatioLiquidNitrogenInput2"
  | "RatioLiquidNitrogenOutput"
  | "RatioLiquidNitrogenOutput2"
  | "RatioLiquidNitrousOxide"
  | "RatioLiquidNitrousOxideInput"
  | "RatioLiquidNitrousOxideInput2"
  | "RatioLiquidNitrousOxideOutput"
  | "RatioLiquidNitrousOxideOutput2"
  | "RatioLiquidOxygen"
  | "RatioLiquidOxygenInput"
  | "RatioLiquidOxygenInput2"
  | "RatioLiquidOxygenOutput"
  | "RatioLiquidOxygenOutput2"
  | "RatioLiquidPollutant"
  | "RatioLiquidPollutantInput"
  | "RatioLiquidPollutantInput2"
  | "RatioLiquidPollutantOutput"
  | "RatioLiquidPollutantOutput2"
  | "RatioLiquidVolatiles"
  | "RatioLiquidVolatilesInput"
  | "RatioLiquidVolatilesInput2"
  | "RatioLiquidVolatilesOutput"
  | "RatioLiquidVolatilesOutput2"
  | "RatioNitrogen"
  | "RatioNitrogenInput"
  | "RatioNitrogenInput2"
  | "RatioNitrogenOutput"
  | "RatioNitrogenOutput2"
  | "RatioNitrousOxide"
  | "RatioNitrousOxideInput"
  | "RatioNitrousOxideInput2"
  | "RatioNitrousOxideOutput"
  | "RatioNitrousOxideOutput2"
  | "RatioOxygen"
  | "RatioOxygenInput"
  | "RatioOxygenInput2"
  | "RatioOxygenOutput"
  | "RatioOxygenOutput2"
  | "RatioPollutant"
  | "RatioPollutantInput"
  | "RatioPollutantInput2"
  | "RatioPollutantOutput"
  | "RatioPollutantOutput2"
  | "RatioPollutedWater"
  | "RatioSteam"
  | "RatioSteamInput"
  | "RatioSteamInput2"
  | "RatioSteamOutput"
  | "RatioSteamOutput2"
  | "RatioVolatiles"
  | "RatioVolatilesInput"
  | "RatioVolatilesInput2"
  | "RatioVolatilesOutput"
  | "RatioVolatilesOutput2"
  | "RatioWater"
  | "RatioWaterInput"
  | "RatioWaterInput2"
  | "RatioWaterOutput"
  | "RatioWaterOutput2"
  | "ReEntryAltitude"
  | "Reagents"
  | "RecipeHash"
  | "ReferenceId"
  | "RequestHash"
  | "RequiredPower"
  | "ReturnFuelCost"
  | "Richness"
  | "Rpm"
  | "SemiMajorAxis"
  | "Setting"
  | "SettingInput"
  | "SettingInputHash"
  | "SettingOutput"
  | "SettingOutputHash"
  | "SignalID"
  | "SignalStrength"
  | "Sites"
  | "Size"
  | "SizeX"
  | "SizeY"
  | "SizeZ"
  | "SolarAngle"
  | "SolarConstant"
  | "SolarIrradiance"
  | "SoundAlert"
  | "Stress"
  | "Survey"
  | "TargetPadIndex"
  | "TargetX"
  | "TargetY"
  | "TargetZ"
  | "Temperature"
  | "TemperatureDifferentialEfficiency"
  | "TemperatureExternal"
  | "TemperatureInput"
  | "TemperatureInput2"
  | "TemperatureOutput"
  | "TemperatureOutput2"
  | "TemperatureSetting"
  | "Throttle"
  | "Thrust"
  | "ThrustToWeight"
  | "Time"
  | "TimeToDestination"
  | "TotalMoles"
  | "TotalMolesInput"
  | "TotalMolesInput2"
  | "TotalMolesOutput"
  | "TotalMolesOutput2"
  | "TotalQuantity"
  | "TrueAnomaly"
  | "Unknown"
  | "VelocityMagnitude"
  | "VelocityRelativeX"
  | "VelocityRelativeY"
  | "VelocityRelativeZ"
  | "VelocityX"
  | "VelocityY"
  | "VelocityZ"
  | "Vertical"
  | "VerticalRatio"
  | "Volume"
  | "VolumeOfLiquid"
  | "WattsReachingContact"
  | "Weight"
  | "WorkingGasEfficiency";
export type SlotLogicType =
  | "Charge"
  | "ChargeRatio"
  | "Class"
  | "Damage"
  | "Efficiency"
  | "FilterType"
  | "Growth"
  | "Health"
  | "LineNumber"
  | "Lock"
  | "Mature"
  | "MaxQuantity"
  | "None"
  | "OccupantHash"
  | "Occupied"
  | "On"
  | "Open"
  | "PrefabHash"
  | "Pressure"
  | "PressureAir"
  | "PressureWaste"
  | "Quantity"
  | "ReferenceId"
  | "Seeding"
  | "SortingClass"
  | "Temperature"
  | "Volume";

export type ReagentMode = "Contents" | "Recipe" | "Required" | "TotalContents";

export type BatchMode = "Average" | "Maximum" | "Minimum" | "Sum";

export interface DeviceDBEntry {
  name: string;
  hash: number;
  desc: string;
  device: boolean;
  dynamic: boolean;
  logic?: { [key in LogicType]?: FieldType };
  slotlogic?: { [key in SlotLogicType]?: number[] };
  slots?: { name: string; typ: SlotClass }[];
  modes?: { [key: number]: string };
  conn?: { [key: number]: [NetworkType, ConnectionRole] };
  slotclass?: SlotClass;
  sorting?: SortingClass;
  pins?: number;
  reagents?: boolean;
  maxquantity?: number;
  filtertype?: string;
  states?: DBStates;
};

export interface DBStates {
  activate: boolean;
  color: boolean;
  lock: boolean;
  mode: boolean;
  onoff: boolean;
  open: boolean;
}

export interface DeviceDB {
  logic_enabled: string[];
  slot_logic_enabled: string[];
  devices: string[];
  items: string[];
  structures: string[];
  db: {
    [key: string]: DeviceDBEntry;
  };
  names_by_hash: { [key: number]: string };
};

