const argumentsList = process.argv.slice(2);
if (argumentsList[0] === "--") argumentsList.shift();
const [environmentName] = argumentsList;
const expectedByEnvironment = {
  test: "smartcut64-license-state:test:24c50e674aed45f9830034c9451706e3:v1",
  production: "smartcut64-license-state:production:b48acd15f08540abbdb7026cbdbb0319:v1"
};
const expected = expectedByEnvironment[environmentName];
if (!expected) {
  throw new Error("Usage: node scripts/check-state-marker.mjs <test|production>");
}

let input = "";
for await (const chunk of process.stdin) input += chunk;
if (input.trim() !== expected) {
  throw new Error(`The ${environmentName} licence-state namespace marker is missing or incorrect.`);
}

console.log(`SmartCut64 ${environmentName} licence-state namespace marker is correct.`);
