import type { components } from "../api/schema";

export type AdminObjectView = components["schemas"]["AdminObjectView"];
export type AdminObjectPage = components["schemas"]["AdminObjectPage"];

export const amphora: AdminObjectView = {
  id: "11111111-1111-1111-1111-111111111111",
  object_number: "LM-0042",
  object_name: "Amphora",
  number_of_objects: 1,
  brief_description: "Storage jar",
  current_location: "Vault 3",
  current_owner: null,
  recorder: null,
  recording_date: null,
  visibility: "public",
  created_at: "2026-01-02T10:00:00Z",
  updated_at: "2026-01-05T14:30:00Z",
  fields: {},
};

export const fibula: AdminObjectView = {
  ...amphora,
  id: "22222222-2222-2222-2222-222222222222",
  object_number: "LM-0043",
  object_name: "Bronze fibula",
  visibility: "internal",
  fields: {},
};

export const objectsPage: AdminObjectPage = {
  items: [amphora, fibula],
  total: 2,
  limit: 50,
  offset: 0,
};

export type FieldDefinitionView = components["schemas"]["FieldDefinitionView"];
export type TermView = components["schemas"]["TermView"];
export type AuthorityView = components["schemas"]["AuthorityView"];

export const fieldDefinitions: FieldDefinitionView[] = [
  { key: "inscription", data_type: "text", vocabulary_id: null, authority_kind: null,
    required: true, group: "Description", labels: [{ lang: "en", label: "Inscription" }, { lang: "sv", label: "Inskription" }] },
  { key: "count_seen", data_type: "integer", vocabulary_id: null, authority_kind: null,
    required: false, group: null, labels: [{ lang: "en", label: "Count seen" }] },
  { key: "made_on", data_type: "date", vocabulary_id: null, authority_kind: null,
    required: false, group: null, labels: [{ lang: "en", label: "Made on" }] },
  { key: "is_fragment", data_type: "boolean", vocabulary_id: null, authority_kind: null,
    required: false, group: null, labels: [{ lang: "en", label: "Is fragment" }] },
  { key: "title_ml", data_type: "localized_text", vocabulary_id: null, authority_kind: null,
    required: false, group: null, labels: [{ lang: "en", label: "Title" }] },
  { key: "material", data_type: "term", vocabulary_id: "v-material", authority_kind: null,
    required: false, group: null, labels: [{ lang: "en", label: "Material" }] },
  { key: "maker", data_type: "authority", vocabulary_id: null, authority_kind: "person",
    required: false, group: null, labels: [{ lang: "en", label: "Maker" }] },
];

export const materialTerms: TermView[] = [
  { id: "t-bronze", external_uri: null, labels: [{ lang: "en", label: "Bronze" }, { lang: "sv", label: "Brons" }] },
  { id: "t-wood", external_uri: null, labels: [{ lang: "en", label: "Wood" }] },
];

export const personAuthorities: AuthorityView[] = [
  { id: "a-ada", kind: "person", external_uri: null, labels: [{ lang: "en", label: "Ada Lovelace" }] },
];

export type SearchHitView = components["schemas"]["SearchHitView"];

export const searchHits: SearchHitView[] = [
  {
    id: amphora.id,
    object_number: "2019.4.12",
    object_name: "Bronze figurine",
    brief_description: "A small cast figure.",
    recording_date: "1962-04-03",
    visibility: "public",
    snippet: "cast bronze with green patina",
  },
  ...Array.from({ length: 24 }, (_, i) => ({
    id: `s-${i + 2}`,
    object_number: `N-${i + 2}`,
    object_name: `Object ${i + 2}`,
    brief_description: null,
    recording_date: null,
    visibility: "internal" as const,
    snippet: null,
  })),
];

export type VocabularyView = components["schemas"]["VocabularyView"];

export const vocabularies: VocabularyView[] = [
  { id: "v-material", key: "material" },
  { id: "v-technique", key: "technique" },
];
