/** @type {{ DataStoreName: string, StateVersion: number, IncomeTickMs: number, SaveIntervalMs: number, Plot: object, Conveyor: object, Mutation: object, Events: object, Visitor: object, Time: object, Weather: object, Quests: object, Prestige: object }} */
export const GameConfig = {
  DataStoreName: "BuildAZooWeb_v1",
  StateVersion: 2,
  /** Game loop interval (ms). Minimum 5000 to limit DB/API load. */
  IncomeTickMs: 5000,
  /** Save to localStorage/API at most every this many ms. */
  SaveIntervalMs: 5000,

  Plot: {
    BaseWidth: 6,
    BaseHeight: 6,
    MaxLevel: 8,
    ExpandByLevel: 2,
    BaseUpgradeCost: 300,
    UpgradeGrowth: 1.7,
  },

  Conveyor: {
    MaxLevel: 8,
    BaseUpgradeCost: 250,
    UpgradeGrowth: 1.65,
    OfferCount: 3,
    /** Min seconds between conveyor offer refresh. >= 5 to limit load. */
    RefreshSeconds: 8,
  },

  WorldMap: {
    Zoos: [
      { id: "player", name: "Mon zoo", x: 25, y: 50, animalWeights: { Basic: 1, Ocean: 0, Mountain: 0 } },
      { id: "zoo_nord", name: "Zoo du Nord", x: 75, y: 15, animalWeights: { Basic: 2, Ocean: 1, Mountain: 1 } },
      { id: "zoo_est", name: "Zoo de l'Est", x: 85, y: 55, animalWeights: { Basic: 1, Ocean: 2, Mountain: 0 } },
      { id: "zoo_sud", name: "Zoo du Sud", x: 50, y: 85, animalWeights: { Basic: 1, Ocean: 1, Mountain: 2 } },
      { id: "zoo_ouest", name: "Zoo de l'Ouest", x: 15, y: 25, animalWeights: { Basic: 2, Ocean: 0, Mountain: 1 } },
    ],
    Cities: [
      { id: "ville_nord", name: "Ville du Nord", x: 80, y: 10, maxVisitorsTowardZoos: 80 },
      { id: "ville_sud", name: "Ville du Sud", x: 45, y: 90, maxVisitorsTowardZoos: 80 },
      { id: "ville_centre", name: "Ville centrale", x: 50, y: 50, maxVisitorsTowardZoos: 100 },
    ],
    Laboratory: { x: 50, y: 20, name: "Laboratoire" },
    TruckAnimationMs: 2500,
    NpcTruckIntervalMs: 8000,
    MapUpgrade: {
      MaxLevel: 5,
      BaseUpgradeCost: 350,
      UpgradeGrowth: 1.5,
      /** Cost in research points per level (agrandissement carte). */
      BaseResearchCost: 15,
      ResearchUpgradeGrowth: 1.6,
    },
  },

  Bots: {
    /** Max distance (in map %) to consider a zoo as neighbor for color weights. */
    NeighborMaxDistance: 35,
    /** Min seconds between two decision ticks per bot. */
    TickIntervalMinSeconds: 8,
    TickIntervalMaxSeconds: 25,
    /** Initial coins range for new bots. */
    InitialCoinsMin: 150,
    InitialCoinsMax: 450,
  },

  Truck: {
    MaxLevel: 7,
    BaseUpgradeCost: 400,
    UpgradeGrowth: 1.5,
  },

  School: {
    MaxLevel: 8,
    BaseUpgradeCost: 250,
    UpgradeGrowth: 1.65,
  },

  /** Centre de recherche (Rappel grandes règles): 7 niveaux, unités de recherche pour agrandir la carte, 10 zoos/unité. */
  Research: {
    MaxLevel: 7,
    ZoosPerUnit: 10,
    BuildCost: 300,
    BaseUpgradeCost: 320,
    UpgradeGrowth: 1.6,
    PointsPerTickPerLevel: 0.1,
  },

  /** Billeterie: 7 niveaux, 20 visiteurs/unité en simultané. */
  Billeterie: {
    MaxLevel: 7,
    VisitorsPerUnit: 20,
    BuildCost: 280,
    BaseUpgradeCost: 280,
    UpgradeGrowth: 1.55,
    /** Opening hour (0-24). No new visitors outside [OpenHour, CloseHour). */
    OpenHour: 8,
    CloseHour: 20,
    /** Max new visitors per real second at entry (spec: 1 visiteur/s). */
    MaxEntryPerSecond: 1,
  },

  /** Nourriture: 7 niveaux, 5 animaux/unité. */
  Food: {
    MaxLevel: 7,
    AnimalsPerUnit: 5,
    BuildCost: 260,
    BaseUpgradeCost: 260,
    UpgradeGrowth: 1.5,
    /** Seconds without being fed before the animal dies. */
    MaxSecondsWithoutFood: 120,
  },

  /** Accueil nouveaux animaux: 7 niveaux, 1 animal/unité. */
  Reception: {
    MaxLevel: 7,
    AnimalsPerUnit: 1,
    BuildCost: 240,
    BaseUpgradeCost: 240,
    UpgradeGrowth: 1.55,
    AcclimatationSecondsBase: 45,
    /** Seconds a ready animal can wait without being placed before dying. */
    MaxSecondsReadyNotPlaced: 90,
  },

  /** Changement de milieu (couleur): 7 niveaux, payant. */
  BiomeChangeColor: {
    MaxLevel: 7,
    BuildCost: 340,
    BaseUpgradeCost: 350,
    UpgradeGrowth: 1.6,
  },

  /** Changement de milieu (température): 7 niveaux, payant. */
  BiomeChangeTemp: {
    MaxLevel: 7,
    BuildCost: 340,
    BaseUpgradeCost: 350,
    UpgradeGrowth: 1.6,
  },

  Mutation: {
    BaseChance: 0.06,
  },

  /** Death cause "seuls": animal dies if no same species in radius for too long. */
  Animal: {
    MinSameSpeciesInRadius: 1,
    RadiusCells: 5,
    MaxSecondsAlone: 300,
  },

  Events: [],

  Visitor: {
    BasePaymentPerVisitor: 0.15,
    VisitorsPerAnimal: 1.2,
    PlotLevelBonus: 0.1,
    StagnationDecayAfterSeconds: 60,
    StagnationDecayPerMinute: 0.05,
    CityAttractionScale: 0.002,
    AnimalValueScale: 0.00015,
    MaxSecondsWithoutVisit: 300,
    SouvenirShopBonusPerShop: 0.2,
    LuxuryGuestChance: 0.08,
    LuxuryEntryMultiplier: 3,
    LuxuryShopMultiplier: 2.5,
    AttractivityDeathPenalty: 0.5,
    AttractivityBirthBonus: 0.2,
    StayMultiplierPerShopLevel: 0.15,
    StayMultiplierPerSpecies: 0.02,
    IncidentChanceBase: 0.002,
    IncidentChanceWaitMultiplier: 4,
    IncidentTimeoutSeconds: 45,
    IncidentResolveAttractivityBonus: 0.15,
    IncidentResolveCoinBonus: 8,
    IncidentUnresolvedAttractivityPenalty: 0.2,
  },

  Nursery: {
    BuildCost: 200,
    MaxLevel: 7,
    BaseUpgradeCost: 180,
    UpgradeGrowth: 1.5,
    GrowthSecondsBase: 40,
    MaxSecondsMatureNotPlaced: 90,
  },

  /** Reproduction: delay between pair detection and baby birth; reduced by zoo score and biome/temp fit. */
  Reproduction: {
    BaseSeconds: 60,
    MaxDistance: 1,
  },

  SouvenirShop: {
    BuildCost: 250,
    MaxLevel: 7,
    BaseUpgradeCost: 220,
    UpgradeGrowth: 1.55,
  },

  Time: {
    DayLengthSeconds: 120,
    PhaseShift: 0,
  },

  /** 4 seasons: spring, summer, autumn, winter. Each season lasts DaysPerSeason game days. */
  Season: {
    DaysPerSeason: 7,
    TemperatureModifier: { spring: 0, summer: 10, autumn: -2, winter: -15 },
    VisitorMultiplier: { spring: 1, summer: 1.5, autumn: 0.8, winter: 0.6 },
    ReproductionBonus: { spring: 0.2, summer: 0, autumn: 0, winter: -0.5 },
    /** Billeterie: summer +20% ticket price, winter -10%. */
    TicketPriceMultiplier: { spring: 1, summer: 1.2, autumn: 1, winter: 0.9 },
  },

  Weather: {
    ChangeIntervalSeconds: 45,
    RainChance: 0.25,
    CloudyChance: 0.35,
  },

  Quests: {
    CountPerDay: 3,
    RewardBase: 50,
    RewardPerLevel: 20,
  },

  Prestige: {
    IncomeBonusPerLevel: 0.15,
    MinCoinsToReset: 5000,
  },

  /** Phase 10: sale listings (baby/animal on truck → world map). Bébé invendu meurt après ce délai. */
  Sale: {
    ListingDurationSeconds: 3600,
    DefaultPrice: 50,
  },
};
