"use strict";
var import_vitest = require("vitest");
var import_modelOrdering = require("./modelOrdering.js");
function sortModels(models) {
  return [...models].sort(import_modelOrdering.compareModelsLatestFirst).map((model) => model.name);
}
(0, import_vitest.describe)("compareModelsLatestFirst", () => {
  (0, import_vitest.it)("prioritizes releaseDate over version-like tokens in model names", () => {
    const sorted = sortModels([
      { name: "gpt-oss-120b" },
      { name: "gpt-5.2", releaseDate: "2026-02-05" },
      { name: "gpt-5.1", releaseDate: "2025-12-11" }
    ]);
    (0, import_vitest.expect)(sorted).toEqual(["gpt-5.2", "gpt-5.1", "gpt-oss-120b"]);
  });
  (0, import_vitest.it)("sorts by releaseDate descending when available", () => {
    const sorted = sortModels([
      { name: "gpt-4", releaseDate: "2023-11-06" },
      { name: "gpt-5", releaseDate: "2025-08-07" },
      { name: "gpt-4o", releaseDate: "2024-05-13" }
    ]);
    (0, import_vitest.expect)(sorted).toEqual(["gpt-5", "gpt-4o", "gpt-4"]);
  });
  (0, import_vitest.it)("keeps dated models ahead of undated models", () => {
    const sorted = sortModels([
      { name: "gpt-4.1" },
      { name: "gpt-5.1", releaseDate: "2025-12-11" },
      { name: "gpt-5.2", releaseDate: "2026-02-05" }
    ]);
    (0, import_vitest.expect)(sorted).toEqual(["gpt-5.2", "gpt-5.1", "gpt-4.1"]);
  });
  (0, import_vitest.it)("falls back to numeric-aware version ordering when release dates tie", () => {
    const sorted = sortModels([
      { name: "gpt-5.1", releaseDate: "2025-08-01" },
      { name: "gpt-5.2", releaseDate: "2025-08-01" },
      { name: "gpt-5.10", releaseDate: "2025-08-01" }
    ]);
    (0, import_vitest.expect)(sorted).toEqual(["gpt-5.10", "gpt-5.2", "gpt-5.1"]);
  });
  (0, import_vitest.it)("falls back to numeric-aware ordering for undated models", () => {
    const sorted = sortModels([
      { name: "minimax-m2" },
      { name: "minimax-m2.5" },
      { name: "minimax-m2.1" }
    ]);
    (0, import_vitest.expect)(sorted).toEqual(["minimax-m2.5", "minimax-m2.1", "minimax-m2"]);
  });
});
(0, import_vitest.describe)("isDeprecatedModelStatus", () => {
  (0, import_vitest.it)("returns true for deprecated status", () => {
    (0, import_vitest.expect)((0, import_modelOrdering.isDeprecatedModelStatus)("deprecated")).toBe(true);
    (0, import_vitest.expect)((0, import_modelOrdering.isDeprecatedModelStatus)("DEPRECATED")).toBe(true);
  });
  (0, import_vitest.it)("returns false for undefined or non-deprecated status", () => {
    (0, import_vitest.expect)((0, import_modelOrdering.isDeprecatedModelStatus)(void 0)).toBe(false);
    (0, import_vitest.expect)((0, import_modelOrdering.isDeprecatedModelStatus)("active")).toBe(false);
    (0, import_vitest.expect)((0, import_modelOrdering.isDeprecatedModelStatus)("preview")).toBe(false);
  });
});
