import type { FilesystemFixture } from "./types.js";

export const artifactOwnershipKnownBad: FilesystemFixture = {
  fixtureId: "filesystem/artifact-ownership-known-bad",
  filesystemVersion: "1.0",
  scenarios: [
    {
      scenarioId: "lock-without-collision-safe-owner",
      kind: "artifact-ownership",
      artifactKind: "lock",
      path: "/var/app/.lock",
      ownerId: "worker",
      collisionSafe: false,
      boundedLifetime: true,
      maxLifetimeMs: 300_000,
      observedLifetimeMs: 120_000,
      cleanupOnExit: true,
      cleanupObserved: true,
      staleOwnerRecovery: {
        contractDeclared: true,
        staleDetected: false,
        recovered: true,
        recoveryMethod: "pid-check",
      },
    },
    {
      scenarioId: "temp-without-bounded-lifetime",
      kind: "artifact-ownership",
      artifactKind: "temp",
      path: "/tmp/app-upload-7f3a",
      ownerId: "upload-session-7f3a",
      collisionSafe: true,
      boundedLifetime: false,
      cleanupOnExit: true,
      cleanupObserved: false,
      staleOwnerRecovery: {
        contractDeclared: false,
        staleDetected: false,
        recovered: false,
      },
    },
    {
      scenarioId: "stale-lock-not-recovered",
      kind: "artifact-ownership",
      artifactKind: "lock",
      path: "/var/app/migration.lock",
      ownerId: "migration-worker-dead",
      collisionSafe: true,
      boundedLifetime: true,
      maxLifetimeMs: 600_000,
      observedLifetimeMs: 900_000,
      cleanupOnExit: true,
      cleanupObserved: false,
      staleOwnerRecovery: {
        contractDeclared: true,
        staleDetected: true,
        recovered: false,
      },
    },
    {
      scenarioId: "temp-without-cleanup",
      kind: "artifact-ownership",
      artifactKind: "temp",
      path: "/tmp/export-9c21",
      ownerId: "export-job-9c21",
      collisionSafe: true,
      boundedLifetime: true,
      maxLifetimeMs: 86_400_000,
      observedLifetimeMs: 172_800_000,
      cleanupOnExit: true,
      cleanupObserved: false,
      staleOwnerRecovery: {
        contractDeclared: true,
        staleDetected: true,
        recovered: false,
      },
    },
    {
      scenarioId: "lock-lifetime-exceeded",
      kind: "artifact-ownership",
      artifactKind: "lock",
      path: "/var/app/reindex.lock",
      ownerId: "reindex-worker",
      collisionSafe: true,
      boundedLifetime: true,
      maxLifetimeMs: 120_000,
      observedLifetimeMs: 480_000,
      cleanupOnExit: false,
      cleanupObserved: false,
      staleOwnerRecovery: {
        contractDeclared: false,
        staleDetected: false,
        recovered: false,
      },
    },
  ],
};
