using System;
using Server;
using Server.Multis;

namespace Server.Custom.InnRooms
{
    public class InnRoomHouse : BaseHouse
    {
        public override Rectangle2D[] Area
        {
            get { return new Rectangle2D[] { new Rectangle2D(-5, -5, 10, 10) }; }
        }

        public override Point3D BaseBanLocation
        {
            get { return new Point3D(this.X, this.Y - 5, this.Z + 20); }
        }

        public InnRoomHouse(Mobile owner) : base(0x1DF3, owner, 50, 2) 
        {
            RestrictDecay = true; 
        }

        public InnRoomHouse(Serial serial) : base(serial)
        {
        }

        // --- THE LOCKDOWN FIX ---
        public override int GetAosMaxLockdowns()
        {
            return 50; // 50 floor items
        }

        public override int GetAosMaxSecures()
        {
            return 250; // 250 total items in the room
        }
        // ------------------------

        public override bool IsInside(Point3D p, int height)
        {
            if (Deleted)
                return false;

            int rx = p.X - this.X;
            int ry = p.Y - this.Y;

            bool inArea = false;
            foreach (Rectangle2D rect in Area)
            {
                if (rect.Contains(new Point2D(rx, ry)))
                {
                    inArea = true;
                    break;
                }
            }

            if (!inArea)
                return false;

            if (p.Z >= this.Z && (p.Z + height) <= this.Z + 40)
                return true;

            return false;
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0); 
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }
    }
}
