// SPDX-FileCopyrightText: 2022 Johannes Loher
//
// SPDX-License-Identifier: MIT

import type { DS4 } from "../../../config";
import type { DS4ItemDataSourceDataBase, DS4ItemDataSourceDataEquipable } from "../item-data-source-base";

export interface DS4SpellDataSource {
  type: "spell";
  data: DS4SpellDataSourceData;
}

export interface DS4SpellDataSourceData extends DS4ItemDataSourceDataBase, DS4ItemDataSourceDataEquipable {
  spellType: keyof typeof DS4.i18n.spellTypes;
  spellModifier: {
    numerical: number;
    complex: string;
  };
  allowsDefense: boolean;
  spellGroups: Record<keyof typeof DS4.i18n.spellGroups, boolean>;
  maxDistance: UnitData<DistanceUnit>;
  effectRadius: UnitData<DistanceUnit>;
  duration: UnitData<TemporalUnit>;
  cooldownDuration: CooldownDuration;
  minimumLevels: {
    healer: number | null;
    wizard: number | null;
    sorcerer: number | null;
  };
}

export interface UnitData<UnitType> {
  value: string;
  unit: UnitType;
}

type DistanceUnit = keyof typeof DS4.i18n.distanceUnits;
type TemporalUnit = keyof typeof DS4.i18n.temporalUnits;
export type CooldownDuration = keyof typeof DS4.i18n.cooldownDurations;
