import { Entity, EntityComponentTypes, EntityEquippableComponent, EntityHealthComponent, EntityInventoryComponent, EntityIsChargedComponent, EntityItemComponent, EntityTypeFamilyComponent } from "@minecraft/server";

/**
 * This class is created for typings
 */
export class EntityComponents {

    /**
     * 
     * @param {Entity} entity
     * @returns {EntityHealthComponent} 
     */
    static getHealth(entity) {
        return entity.getComponent(EntityComponentTypes.Health)
    }

    /**
     * 
     * @param {Entity} entity
     * @returns {EntityTypeFamilyComponent} 
     */
    static getFamilyType(entity) { 
        return entity.getComponent(EntityComponentTypes.TypeFamily)
    }

    /**
     * 
     * @param {Entity} entity
     * @returns {EntityIsChargedComponent} 
     */

    static getIsCharged(entity) {
        return entity.getComponent(EntityComponentTypes.IsCharged)
    }

    /**
     * @param {Entity} entity
     * @returns {EntityEquippableComponent} 
     * */
    static getEquippable(entity) {
        return entity.getComponent(EntityComponentTypes.Equippable)
    }

    
    /**
     * @param {Entity} entity 
     * @returns {EntityItemComponent}
     */
    static getEntityItem(entity) {
        return entity.getComponent(EntityComponentTypes.Item)
    }

    /**
     * 
     * @param {Entity} entity 
     * @returns {EntityInventoryComponent}
     */
    static getInventory(entity) {
        return entity.getComponent(EntityComponentTypes.Inventory)
    }

}