using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Serialization;
using VOID.Generic.Dict;
using VOID.Generic.Objects.Abstract.Events;
using VOID.Generic.Objects.Container.Events;
using VOID.Generic.Objects.Item.Events;
using VOID.Generic.Objects.Unit.Events;
using VOID.Generic.Objects.Usable.Events;
using VOID.Generic.Objects.Wearable.Events;

namespace VOID.Generic.Objects.Unit
{
    [Serializable]
    public class UnitObjectEvents : ObjectComponent<UnitObject>
    {
        // ANIMATION RELATED EVENTS
        [Header("Animations")]
        public Dictionary<AnimationType, AnimationGenericEventSet> onAnimation =
            Enum.GetValues(typeof(AnimationType)).Cast<AnimationType>()
                .ToDictionary(o => o, _ => new AnimationGenericEventSet());

        // ACTION RELATED EVENTS
        [Header("Action - PREVENTED BY CHECK")]
        public UnityEvent<ActionErrorEvent> onActionError;
        [Header("Action - Move")]
        public UnityEvent<MoveEvent> onMoveStart;
        public UnityEvent<MoveEvent> onMoveEnd;
        [Header("Action - Damage")]
        public UnityEvent<DamageEvent> onDamageBefore;
        public UnityEvent<DamageEvent> onDamageAfter;
        [Header("Action - Casting")]
        public UnityEvent<CastingEvent> onStartCasting;
        public UnityEvent<CastingEvent> onEndCasting;
        [Header("Action - Ability Cast")]
        public UnityEvent<AbilityCastEvent> onStartAbilityBefore;
        public UnityEvent<AbilityCastEvent> onStartAbilityAfter;
        public UnityEvent<AbilityCastEvent> onEndAbility;
        [Header("Action - Ability Projectile")]
        public UnityEvent<AbilityProjectileEvent> onAbilityProjectileStart;
        public UnityEvent<AbilityProjectileEvent> onAbilityProjectileEnd;
        [Header("Action - Ability Hit")]
        public UnityEvent<AbilityHitEvent> onAbilityHitBefore;
        public UnityEvent<AbilityHitEvent> onAbilityHitAfter;
        [Header("Action - Take")]
        public UnityEvent<PickEvent> onTakeBefore;
        public UnityEvent<PickEvent> onTakeAfter;
        [Header("Action - Drop")]
        public UnityEvent<DropEvent> onDropBefore;
        public UnityEvent<DropEvent> onDropAfter;
        [Header("Action - Equip")]
        public UnityEvent<EquipEvent> onEquipBefore;
        public UnityEvent<EquipEvent> onEquipAfter;
        [Header("Action - UnEquip")]
        public UnityEvent<UnEquipEvent> onUnEquipBefore;
        public UnityEvent<UnEquipEvent> onUnEquipAfter;
        [Header("Action - Use")]
        public UnityEvent<UseEvent> onUseBefore;
        public UnityEvent<UseEvent> onUseAfter;
        [Header("Action - Container")]
        public UnityEvent<ContainerOpenEvent> onContainerOpen;
        public UnityEvent<ContainerCloseEvent> onContainerClose;
        [Header("Action - Other Unit")]
        public UnityEvent<OpenOtherUnitEvent> onOpenOtherUnit;
        public UnityEvent<CloseOtherUnitEvent> onCloseOtherUnit;
        public UnityEvent<OpenOtherUnitEvent> onOpenedByOtherUnit;
        public UnityEvent<CloseOtherUnitEvent> onClosedByOtherUnit;
        [Header("Action - Move Item")]
        public UnityEvent<MoveItemEvent> onMoveItemBefore;
        public UnityEvent<MoveItemEvent> onMoveItemAfter;

        // COMPONENT RELATED EVENTS
        [Header("Backpack")]
        public UnityEvent<BackpackPickEvent> onBackpackPick;
        public UnityEvent<BackpackDropEvent> onBackpackDrop;
        public UnityEvent<BackpackSwapEvent> onBackpackSwap;
        public UnityEvent<BackpackSortEvent> onBackpackSort;
        public UnityEvent<BackpackResizeEvent> onBackpackResize;
        [Header("Equipment")]
        public UnityEvent<EquipmentEquipEvent> onEquipmentEquip;
        public UnityEvent<EquipmentUnEquipEvent> onEquipmentUnEquip;
        [Header("Data")]
        public UnityEvent<MainAttributeChangeEvent> onMainAttributeChange;
        public UnityEvent<SubAttributeChangeEvent> onSubAttributeChange;
        public UnityEvent<UnitResourceChangeEvent> onMaxResourceChange;
        public UnityEvent<UnitResourceChangeEvent> onCurrentResourceChange;
        [Header("ActionBar")]
        public UnityEvent<ActionBarSetEvent> onActionBarSet;
        public UnityEvent<ActionBarUnSetEvent> onActionBarUnSet;
        [Header("AbilityBook")]
        public UnityEvent<AbilityBookAbilityAddedEvent> onAbilityAdded;
        public UnityEvent<AbilityBookAbilityRemovedEvent> onAbilityRemoved;
        public UnityEvent<AbilityBookAttackAbilityChangeEvent> onAttackAbilityChange;
        [Header("Senses")]
        public UnityEvent<SenseSightEvent> onSightEnter;
        public UnityEvent<SenseSightEvent> onSightExit;
        public UnityEvent<SenseHearEvent> onHearEnter;
        public UnityEvent<SenseHearEvent> onHearExit;
        [Header("Level")]
        public UnityEvent<LevelGainEvent> onLevelGain;
        public UnityEvent<ExpGainEvent> onExpGain;
    }
}