// Copyright (c) Strange Loop Games. All rights reserved.
// See LICENSE file in the project root for full license information.

namespace Eco.Mods.TechTree
{
    using Eco.Gameplay.Components;
    using Eco.Gameplay.Items;
    using Eco.Gameplay.Objects;
    using Eco.Shared.Serialization;
    using Eco.Gameplay.Components.Auth;

    [RequireComponent(typeof(PublicStorageComponent))]
    public partial class ShippingContainerObject : WorldObject
    {
        protected override void PostInitialize()
        {
            base.PostInitialize();

            var storage = this.GetComponent<PublicStorageComponent>();
            storage.Initialize(25);
            storage.Storage.AddInvRestriction(new CarriedRestriction()); // only store blocks and large items
            this.GetComponent<PropertyAuthComponent>().Initialize(AuthModeType.Inherited);
            this.GetComponent<LinkComponent>().Initialize(7);
            this.GetComponent<MinimapComponent>().Initialize("ShippingContainer");
        }
    }

    [Serialized]
    [RequireComponent(typeof(PropertyAuthComponent))]
    [RequireComponent(typeof(PublicStorageComponent))]
    [RequireComponent(typeof(LinkComponent))]
    [RequireComponent(typeof(MinimapComponent))]
    [RequireComponent(typeof(WorldStockpileComponent))]
    public class AShippingContainerObject : WorldObject
    {

        public override string FriendlyName { get { return "FunnyMContainerShipping"; } }

        protected override void Initialize()
        {
            base.Initialize();

            var storage = this.GetComponent<PublicStorageComponent>();
            storage.Initialize(25, 8000000);
            storage.Storage.AddInvRestriction(new CarriedRestriction()); // only store blocks and large items
            this.GetComponent<PropertyAuthComponent>().Initialize(AuthModeType.Inherited);
            this.GetComponent<LinkComponent>().Initialize(7);
            this.GetComponent<MinimapComponent>().Initialize("ShippingContainer");
        }
    }
}
