import type { Vector3Dto } from "./contractsCommon";
import type { ShipOrderTemplateSnapshot } from "./contractsShips";

export interface PlayerAssetRegistrySnapshot {
  shipIds: string[];
  stationIds: string[];
  commanderIds: string[];
  claimIds: string[];
  constructionSiteIds: string[];
  policySetIds: string[];
  marketOrderIds: string[];
  fleetIds: string[];
  taskForceIds: string[];
  stationGroupIds: string[];
  economicRegionIds: string[];
  frontIds: string[];
  reserveIds: string[];
}

export interface PlayerStrategicIntentSnapshot {
  strategicPosture: string;
  economicPosture: string;
  militaryPosture: string;
  logisticsPosture: string;
  desiredReserveRatio: number;
  allowDelegatedCombatAutomation: boolean;
  allowDelegatedEconomicAutomation: boolean;
  notes?: string | null;
}

export interface PlayerFleetSnapshot {
  id: string;
  label: string;
  status: string;
  role: string;
  commanderId?: string | null;
  frontId?: string | null;
  homeSystemId?: string | null;
  homeStationId?: string | null;
  policyId?: string | null;
  automationPolicyId?: string | null;
  reinforcementPolicyId?: string | null;
  assetIds: string[];
  taskForceIds: string[];
  directiveIds: string[];
  updatedAtUtc: string;
}

export interface PlayerTaskForceSnapshot {
  id: string;
  label: string;
  status: string;
  role: string;
  fleetId?: string | null;
  commanderId?: string | null;
  frontId?: string | null;
  policyId?: string | null;
  automationPolicyId?: string | null;
  assetIds: string[];
  directiveIds: string[];
  updatedAtUtc: string;
}

export interface PlayerStationGroupSnapshot {
  id: string;
  label: string;
  status: string;
  role: string;
  economicRegionId?: string | null;
  policyId?: string | null;
  automationPolicyId?: string | null;
  stationIds: string[];
  directiveIds: string[];
  focusItemIds: string[];
  updatedAtUtc: string;
}

export interface PlayerEconomicRegionSnapshot {
  id: string;
  label: string;
  status: string;
  role: string;
  sharedEconomicRegionId?: string | null;
  policyId?: string | null;
  automationPolicyId?: string | null;
  systemIds: string[];
  stationGroupIds: string[];
  directiveIds: string[];
  updatedAtUtc: string;
}

export interface PlayerFrontSnapshot {
  id: string;
  label: string;
  status: string;
  priority: number;
  posture: string;
  sharedFrontLineId?: string | null;
  targetFactionId?: string | null;
  systemIds: string[];
  fleetIds: string[];
  reserveIds: string[];
  directiveIds: string[];
  updatedAtUtc: string;
}

export interface PlayerReserveGroupSnapshot {
  id: string;
  label: string;
  status: string;
  reserveKind: string;
  homeSystemId?: string | null;
  policyId?: string | null;
  assetIds: string[];
  frontIds: string[];
  updatedAtUtc: string;
}

export interface PlayerFactionPolicySnapshot {
  id: string;
  label: string;
  scopeKind: string;
  scopeId?: string | null;
  policySetId?: string | null;
  allowDelegatedCombat: boolean;
  allowDelegatedTrade: boolean;
  reserveCreditsRatio: number;
  reserveMilitaryRatio: number;
  tradeAccessPolicy: string;
  dockingAccessPolicy: string;
  constructionAccessPolicy: string;
  operationalRangePolicy: string;
  combatEngagementPolicy: string;
  avoidHostileSystems: boolean;
  fleeHullRatio: number;
  blacklistedSystemIds: string[];
  notes?: string | null;
  updatedAtUtc: string;
}

export interface PlayerAutomationPolicySnapshot {
  id: string;
  label: string;
  scopeKind: string;
  scopeId?: string | null;
  enabled: boolean;
  behaviorKind: string;
  useOrders: boolean;
  stagingOrderKind?: string | null;
  maxSystemRange: number;
  knownStationsOnly: boolean;
  radius: number;
  waitSeconds: number;
  preferredItemId?: string | null;
  notes?: string | null;
  repeatOrders: ShipOrderTemplateSnapshot[];
  updatedAtUtc: string;
}

export interface PlayerReinforcementPolicySnapshot {
  id: string;
  label: string;
  scopeKind: string;
  scopeId?: string | null;
  shipKind: string;
  desiredAssetCount: number;
  minimumReserveCount: number;
  autoTransferReserves: boolean;
  autoQueueProduction: boolean;
  sourceReserveId?: string | null;
  targetFrontId?: string | null;
  notes?: string | null;
  updatedAtUtc: string;
}

export interface PlayerProductionProgramSnapshot {
  id: string;
  label: string;
  status: string;
  kind: string;
  targetShipKind?: string | null;
  targetModuleId?: string | null;
  targetItemId?: string | null;
  targetCount: number;
  currentCount: number;
  stationGroupId?: string | null;
  reinforcementPolicyId?: string | null;
  notes?: string | null;
  updatedAtUtc: string;
}

export interface PlayerDirectiveSnapshot {
  id: string;
  label: string;
  status: string;
  kind: string;
  scopeKind: string;
  scopeId: string;
  targetEntityId?: string | null;
  targetSystemId?: string | null;
  targetPosition?: Vector3Dto | null;
  homeSystemId?: string | null;
  homeStationId?: string | null;
  sourceStationId?: string | null;
  destinationStationId?: string | null;
  behaviorKind: string;
  useOrders: boolean;
  stagingOrderKind?: string | null;
  itemId?: string | null;
  preferredNodeId?: string | null;
  preferredConstructionSiteId?: string | null;
  preferredModuleId?: string | null;
  priority: number;
  radius: number;
  waitSeconds: number;
  maxSystemRange: number;
  knownStationsOnly: boolean;
  patrolPoints: Vector3Dto[];
  repeatOrders: ShipOrderTemplateSnapshot[];
  policyId?: string | null;
  automationPolicyId?: string | null;
  notes?: string | null;
  createdAtUtc: string;
  updatedAtUtc: string;
}

export interface PlayerAssignmentSnapshot {
  id: string;
  assetKind: string;
  assetId: string;
  fleetId?: string | null;
  taskForceId?: string | null;
  stationGroupId?: string | null;
  economicRegionId?: string | null;
  frontId?: string | null;
  reserveId?: string | null;
  directiveId?: string | null;
  policyId?: string | null;
  automationPolicyId?: string | null;
  role: string;
  status: string;
  updatedAtUtc: string;
}

export interface PlayerDecisionLogEntrySnapshot {
  id: string;
  kind: string;
  summary: string;
  relatedEntityKind?: string | null;
  relatedEntityId?: string | null;
  occurredAtUtc: string;
}

export interface PlayerAlertSnapshot {
  id: string;
  kind: string;
  severity: string;
  summary: string;
  assetKind?: string | null;
  assetId?: string | null;
  relatedDirectiveId?: string | null;
  status: string;
  createdAtUtc: string;
}

export interface PlayerFactionSnapshot {
  id: string;
  label: string;
  personaName?: string | null;
  raceId?: string | null;
  sovereignFactionId: string;
  requiresOnboarding: boolean;
  status: string;
  createdAtUtc: string;
  updatedAtUtc: string;
  assetRegistry: PlayerAssetRegistrySnapshot;
  strategicIntent: PlayerStrategicIntentSnapshot;
  fleets: PlayerFleetSnapshot[];
  taskForces: PlayerTaskForceSnapshot[];
  stationGroups: PlayerStationGroupSnapshot[];
  economicRegions: PlayerEconomicRegionSnapshot[];
  fronts: PlayerFrontSnapshot[];
  reserves: PlayerReserveGroupSnapshot[];
  policies: PlayerFactionPolicySnapshot[];
  automationPolicies: PlayerAutomationPolicySnapshot[];
  reinforcementPolicies: PlayerReinforcementPolicySnapshot[];
  productionPrograms: PlayerProductionProgramSnapshot[];
  directives: PlayerDirectiveSnapshot[];
  assignments: PlayerAssignmentSnapshot[];
  decisionLog: PlayerDecisionLogEntrySnapshot[];
  alerts: PlayerAlertSnapshot[];
}
