import { DS4Actor } from "../actor/actor";
import { DS4ActorDataType } from "../actor/actor-data";
import { DS4ItemDataType, DS4Talent } from "./item-data";

/**
 * Extend the basic Item with some very simple modifications.
 * @extends {Item}
 */
export class DS4Item extends Item<DS4ItemDataType, DS4ActorDataType, DS4Actor> {
    /**
     * Augment the basic Item data model with additional dynamic data.
     */
    prepareData(): void {
        super.prepareData();
        this.prepareDerivedData();

        // Get the Item's data
        // const itemData = this.data;
        // const actorData = this.actor ? this.actor.data : {};
        // const data = itemData.data;
    }

    prepareDerivedData(): void {
        if (this.type === "talent") {
            const data = this.data.data as DS4Talent;
            data.rank.total = data.rank.base + data.rank.mod;
        }
    }
}