defmodule ThistleTea.DB.Mangos.CreatureTemplate do
  use Ecto.Schema

  alias ThistleTea.DB.Mangos

  @primary_key {:entry, :integer, autogenerate: false}
  schema "creature_template" do
    field(:name, :string, source: :Name)
    field(:sub_name, :string, source: :SubName)
    field(:min_level, :integer, source: :MinLevel, default: 1)
    field(:max_level, :integer, source: :MaxLevel, default: 1)
    field(:model_id1, :integer, source: :ModelId1, default: 0)
    field(:model_id2, :integer, source: :ModelId2, default: 0)
    field(:model_id3, :integer, source: :ModelId3, default: 0)
    field(:model_id4, :integer, source: :ModelId4, default: 0)
    field(:faction_alliance, :integer, source: :FactionAlliance, default: 0)
    field(:faction_horde, :integer, source: :FactionHorde, default: 0)
    field(:scale, :float, default: 1.0)
    field(:family, :integer, default: 0)
    field(:creature_type, :integer, source: :CreatureType, default: 0)
    field(:inhabit_type, :integer, source: :InhabitType, default: 3)
    field(:regenerate_stats, :integer, source: :RegenerateStats)
    field(:racial_leader, :integer, source: :RacialLeader, default: 0)
    field(:npc_flags, :integer, source: :NpcFlags, default: 0)
    field(:unit_flags, :integer, source: :UnitFlags, default: 0)
    field(:dynamic_flags, :integer, source: :DynamicFlags, default: 0)
    field(:extra_flags, :integer, source: :ExtraFlags, default: 0)
    field(:creature_type_flags, :integer, source: :CreatureTypeFlags, default: 0)
    field(:speed_walk, :float, source: :SpeedWalk, default: 1.0)
    field(:speed_run, :float, source: :SpeedRun, default: 1.14286)
    field(:unit_class, :integer, source: :UnitClass, default: 0)
    field(:rank, :integer, default: 0)
    field(:health_multiplier, :float, source: :HealthMultiplier, default: 1.0)
    field(:power_multiplier, :float, source: :PowerMultiplier, default: 1.0)
    field(:damage_multiplier, :float, source: :DamageMultiplier, default: 1.0)
    field(:damage_variance, :float, source: :DamageVariance, default: 1.0)
    field(:armor_multiplier, :float, source: :ArmorMultiplier, default: 1.0)
    field(:experience_multiplier, :float, source: :ExperienceMultiplier, default: 1.0)
    field(:min_level_health, :integer, source: :MinLevelHealth, default: 0)
    field(:max_level_health, :integer, source: :MaxLevelHealth, default: 0)
    field(:min_level_mana, :integer, source: :MinLevelMana, default: 0)
    field(:max_level_mana, :integer, source: :MaxLevelMana, default: 0)
    field(:min_melee_dmg, :float, source: :MinMeleeDmg, default: 0.0)
    field(:max_melee_dmg, :float, source: :MaxMeleeDmg, default: 0.0)
    field(:min_ranged_dmg, :float, source: :MinRangedDmg, default: 0.0)
    field(:max_ranged_dmg, :float, source: :MaxRangedDmg, default: 0.0)
    field(:armor, :integer, default: 0)
    field(:melee_attack_power, :integer, source: :MeleeAttackPower, default: 0)
    field(:ranged_attack_power, :integer, source: :RangedAttackPower, default: 0)
    field(:melee_base_attack_time, :integer, source: :MeleeBaseAttackTime, default: 2000)
    field(:ranged_base_attack_time, :integer, source: :RangedBaseAttackTime, default: 2000)
    field(:damage_school, :integer, source: :DamageSchool, default: 0)
    field(:min_loot_gold, :integer, source: :MinLootGold, default: 0)
    field(:max_loot_gold, :integer, source: :MaxLootGold, default: 0)
    field(:loot_id, :integer, source: :LootId, default: 0)
    field(:pickpocket_loot_id, :integer, source: :PickpocketLootId, default: 0)
    field(:skinning_loot_id, :integer, source: :SkinningLootId, default: 0)
    field(:kill_credit1, :integer, source: :KillCredit1, default: 0)
    field(:kill_credit2, :integer, source: :KillCredit2, default: 0)
    field(:mechanic_immune_mask, :integer, source: :MechanicImmuneMask, default: 0)
    field(:school_immune_mask, :integer, source: :SchoolImmuneMask, default: 0)
    field(:resistance_holy, :integer, source: :ResistanceHoly, default: 0)
    field(:resistance_fire, :integer, source: :ResistanceFire, default: 0)
    field(:resistance_nature, :integer, source: :ResistanceNature, default: 0)
    field(:resistance_frost, :integer, source: :ResistanceFrost, default: 0)
    field(:resistance_shadow, :integer, source: :ResistanceShadow, default: 0)
    field(:resistance_arcane, :integer, source: :ResistanceArcane, default: 0)
    field(:spell_list_id, :integer, source: :SpellListId, default: 0)
    field(:pet_spell_data_id, :integer, source: :PetSpellDataId, default: 0)
    field(:movement_type, :integer, source: :MovementType, default: 0)
    field(:trainer_type, :integer, source: :TrainerType, default: 0)
    field(:trainer_spell, :integer, source: :TrainerSpell, default: 0)
    field(:trainer_class, :integer, source: :TrainerClass, default: 0)
    field(:trainer_race, :integer, source: :TrainerRace, default: 0)
    field(:trainer_template_id, :integer, source: :TrainerTemplateId, default: 0)
    field(:vendor_template_id, :integer, source: :VendorTemplateId, default: 0)
    field(:gossip_menu_id, :integer, source: :GossipMenuId, default: 0)
    field(:equipment_template_id, :integer, source: :EquipmentTemplateId, default: 0)
    field(:civilian, :integer, default: 0)
    field(:ai_name, :string, source: :AIName, default: "")

    has_many(:gossip_menu, Mangos.GossipMenu, foreign_key: :entry, references: :gossip_menu_id)
  end
end
