// SPDX-FileCopyrightText: 2026 Kerstin Humm <kerstin@erictapen.name>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

import { AnnotatedWrapper, Rule, isString, JsonPath } from "../types.js";
import { buildReference } from "../utils.js";

function annotatePlace(): void {
}

function annotateLocation(result: AnnotatedWrapper, path: JsonPath): void {
}

export default {
  name: "location attribute",
  validate: (self) => {
    let result = new AnnotatedWrapper();

    result.assert(self, ["location"], isString, {
      kind: "Violation",
      id: "LocationIsText",
      text: "location is a string",
      reference: buildReference({
        anchor: "location",
	text: "Unlike the original Schema.org definition, Text is not a permitted type for location and MUST NOT be used. If only a name is required to describe a location, the Place type can be used."
      }),
    });

    return result.value;
  },
  tests: [
    {value: { "location": "Just some text"},
    result: {annotations: [], object: { "location": "LocationIsText"}},
    },
    {value: {"location": [{}, {}]},
    result: {annotations: [], object: { "location": ["Correct", "Correct"]}},
    },
  ],
} satisfies Rule;
