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

import { ModifiableDataBaseTotalMax } from "../common/common-data";
import {
    DS4AlphabetDataSourceData,
    DS4ArmorDataSourceData,
    DS4EquipmentDataSourceData,
    DS4LanguageDataSourceData,
    DS4LootDataSourceData,
    DS4RacialAbilityDataSourceData,
    DS4ShieldDataSourceData,
    DS4SpecialCreatureAbilityDataSourceData,
    DS4SpellDataSourceData,
    DS4TalentDataSourceData,
    DS4WeaponDataSourceData,
} from "./item-data-source";

declare global {
    interface DataConfig {
        Item: DS4ItemDataProperties;
    }
}

export type DS4ItemDataProperties =
    | DS4WeaponDataProperties
    | DS4ArmorDataProperties
    | DS4ShieldDataProperties
    | DS4SpellDataProperties
    | DS4EquipmentDataProperties
    | DS4LootDataProperties
    | DS4TalentDataProperties
    | DS4RacialAbilityDataProperties
    | DS4LanguageDataProperties
    | DS4AlphabetDataProperties
    | DS4SpecialCreatureAbilityDataProperties;

export interface DS4WeaponDataProperties {
    type: "weapon";
    data: DS4WeaponDataPropertiesData;
}

export interface DS4ArmorDataProperties {
    type: "armor";
    data: DS4ArmorDataPropertiesData;
}

export interface DS4ShieldDataProperties {
    type: "shield";
    data: DS4ShieldDataPropertiesData;
}

export interface DS4SpellDataProperties {
    type: "spell";
    data: DS4SpellDataPropertiesData;
}

export interface DS4EquipmentDataProperties {
    type: "equipment";
    data: DS4EquipmentDataPropertiesData;
}

export interface DS4LootDataProperties {
    type: "loot";
    data: DS4LootDataPropertiesData;
}

export interface DS4TalentDataProperties {
    type: "talent";
    data: DS4TalentDataPropertiesData;
}

export interface DS4RacialAbilityDataProperties {
    type: "racialAbility";
    data: DS4RacialAbilityDataPropertiesData;
}

export interface DS4LanguageDataProperties {
    type: "language";
    data: DS4LanguageDataPropertiesData;
}

export interface DS4AlphabetDataProperties {
    type: "alphabet";
    data: DS4AlphabetDataPropertiesData;
}

export interface DS4SpecialCreatureAbilityDataProperties {
    type: "specialCreatureAbility";
    data: DS4SpecialCreatureAbilityDataPropertiesData;
}

// templates

interface DS4ItemDataPropertiesDataRollable {
    rollable: boolean;
}

//types

interface DS4WeaponDataPropertiesData extends DS4WeaponDataSourceData, DS4ItemDataPropertiesDataRollable {}

interface DS4ArmorDataPropertiesData extends DS4ArmorDataSourceData, DS4ItemDataPropertiesDataRollable {}

interface DS4ShieldDataPropertiesData extends DS4ShieldDataSourceData, DS4ItemDataPropertiesDataRollable {}

interface DS4SpellDataPropertiesData extends DS4SpellDataSourceData, DS4ItemDataPropertiesDataRollable {
    price: number | null;
}

interface DS4EquipmentDataPropertiesData extends DS4EquipmentDataSourceData, DS4ItemDataPropertiesDataRollable {}

interface DS4LootDataPropertiesData extends DS4LootDataSourceData, DS4ItemDataPropertiesDataRollable {}

interface DS4TalentDataPropertiesData extends DS4TalentDataSourceData, DS4ItemDataPropertiesDataRollable {
    rank: ModifiableDataBaseTotalMax<number>;
}

interface DS4RacialAbilityDataPropertiesData
    extends DS4RacialAbilityDataSourceData,
        DS4ItemDataPropertiesDataRollable {}

interface DS4LanguageDataPropertiesData extends DS4LanguageDataSourceData, DS4ItemDataPropertiesDataRollable {}

interface DS4AlphabetDataPropertiesData extends DS4AlphabetDataSourceData, DS4ItemDataPropertiesDataRollable {}

interface DS4SpecialCreatureAbilityDataPropertiesData
    extends DS4SpecialCreatureAbilityDataSourceData,
        DS4ItemDataPropertiesDataRollable {}