// Copyright (c) Strange Loop Games. All rights reserved.
// See LICENSE file in the project root for full license information.
// <auto-generated from VehicleTemplate.cs />

namespace Eco.Mods.TechTree
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using Eco.Core.Items;
    using Eco.Gameplay.Components;
    using Eco.Gameplay.Components.Auth;
    using Eco.Gameplay.Components.VehicleModules;
    using Eco.Gameplay.DynamicValues;
    using Eco.Gameplay.Items;
    using Eco.Gameplay.Objects;
    using Eco.Gameplay.Players;
    using Eco.Gameplay.Skills;
    using Eco.Gameplay.Systems.TextLinks;
    using Eco.Shared.Math;
    using Eco.Shared.Networking;
    using Eco.Shared.Localization;
    using Eco.Shared.Serialization;
    using Eco.Shared.Utils;
    
    [Serialized]
    [LocDisplayName("Wheelbarrow")]
    [Weight(5000)]
    [Ecopedia("Crafted Objects", "Vehicles", createAsSubPage: true, display: InPageTooltip.DynamicTooltip)]
    public partial class WheelbarrowItem : WorldObjectItem<WheelbarrowObject>
    {
        public override LocString DisplayDescription { get { return Localizer.DoStr("Small wheelbarrow for hauling minimal loads."); } }
    }


    [RequiresSkill(typeof(CarpentrySkill), 1)]
    public partial class WheelbarrowRecipe : RecipeFamily
    {
        public WheelbarrowRecipe()
        {
            var recipe = new Recipe();
            recipe.Init(
                "Wheelbarrow",  //noloc
                Localizer.DoStr("Wheelbarrow"),
                new List<IngredientElement>
                {
                    new IngredientElement("HewnLog", 2, typeof(CarpentrySkill)), //noloc
                    new IngredientElement("WoodBoard", 4, typeof(CarpentrySkill)), //noloc
                    new IngredientElement(typeof(WoodenWheelItem), 1, true),
                },
                new List<CraftingElement>
                {
                    new CraftingElement<WheelbarrowItem>()
                });
            this.Recipes = new List<Recipe> { recipe };
            this.ExperienceOnCraft = 5;
            this.LaborInCalories = CreateLaborInCaloriesValue(75, typeof(CarpentrySkill));
            this.CraftMinutes = CreateCraftTimeValue(typeof(WheelbarrowRecipe), 2, typeof(CarpentrySkill));
            this.ModsPreInitialize();
            this.Initialize(Localizer.DoStr("Wheelbarrow"), typeof(WheelbarrowRecipe));
            this.ModsPostInitialize();
            CraftingComponent.AddRecipe(typeof(WorkbenchObject), this);
        }

        /// <summary>Hook for mods to customize RecipeFamily before initialization. You can change recipes, xp, labor, time here.</summary>
        partial void ModsPreInitialize();
        /// <summary>Hook for mods to customize RecipeFamily after initialization, but before registration. You can change skill requirements here.</summary>
        partial void ModsPostInitialize();
    }

    [Serialized]
    [RequireComponent(typeof(StandaloneAuthComponent))]
    [RequireComponent(typeof(PublicStorageComponent))]
    [RequireComponent(typeof(MovableLinkComponent))]
    [RequireComponent(typeof(VehicleComponent))]
    [RequireComponent(typeof(TailingsReportComponent))]
    public partial class WheelbarrowObject : PhysicsWorldObject, IRepresentsItem
    {
        static WheelbarrowObject()
        {
            WorldObject.AddOccupancy<WheelbarrowObject>(new List<BlockOccupancy>(0));
        }

        public override LocString DisplayName { get { return Localizer.DoStr("Wheelbarrow"); } }
        public Type RepresentedItemType { get { return typeof(WheelbarrowItem); } }


        private WheelbarrowObject() { }

        protected override void Initialize()
        {
            base.Initialize();
            
            this.GetComponent<PublicStorageComponent>().Initialize(8, 1400000);
            this.GetComponent<VehicleComponent>().Initialize(10, 1, 1);
            this.GetComponent<VehicleComponent>().HumanPowered(0.5f);
        }
    }
}
