import { Metadata } from '.';

export interface Spell {
  id: string;
  name: string;
  school: string;
  level: number;
  ritual: boolean;
  casting_time: CastingTime;
  saving_throw?: string[];
  attack_type?: string;
  damage_inflict?: string[];
  damage_resist?: string[];
  conditions?: string[];
  range: Range;
  area?: Area;
  components: Components;
  durations: Duration[];
  classes: string[];
  sources: Source[];
  tags?: string[];
  description?: Description;
}

export interface CastingTime {
  value: number;
  unit: string;
}

export interface Range {
  type: string;
  value?: number;
  unit?: string;
}

export interface Area {
  type: string;
  value?: number;
  unit?: string;
}

export interface Components {
  verbal: boolean;
  somatic: boolean;
  material: boolean;
  materials_needed?: string;
  materials_cost?: number;
  materials_consumed?: boolean;
}

export interface Duration {
  type: string;
  value?: number;
  unit?: string;
  // concentration: boolean;
}

export interface Source {
  source: string;
  page?: number;
}

export interface Description {
  // entries: EntryType[];
  entries: Entry[];
}

// type EntryType = string | Entry;

export interface Entry {
  text?: string;
  list?: string[];
  table?: EntryTable;
}

export interface EntryTable {
  headers: string[];
  rows: string[][];
}

export interface GetSpellResponse {
  data: Spell;
  metadata: Metadata;
}

export interface GetSpellsResponse {
  data: Spell[];
  metadata: Metadata;
}
