namespace InABox.Core
{
    public class Address : EnclosedEntity, IPersistent, IRemotable
    {
        [EditorSequence(1)]
        [MemoEditor]
        public string Street { get; set; } = "";

        [EditorSequence(2)]
        [TextBoxEditor]
        public string City { get; set; } = "";

        [EditorSequence(3)]
        [ComboLookupEditor(typeof(StateLookups))]
        public string State { get; set; } = "";

        [EditorSequence(4)]
        [CodeEditor(Editable = Editable.Enabled)]
        public string PostCode { get; set; } = "";

        [NullEditor]
        public Location Location { get; set; }

        private class StateLookups : LookupGenerator<object>
        {
            public StateLookups(object[] items) : base(items)
            {
                AddValue("Australian Capital Territory", "Australian Capital Territory");
                AddValue("New South Wales", "New South Wales");
                AddValue("Northern Territory", "Northern Territory");
                AddValue("Queensland", "Queensland");
                AddValue("South Australia", "South Australia");
                AddValue("Tasmania", "Tasmania");
                AddValue("Victoria", "Victoria");
                AddValue("Western Australia", "Western Australia");
            }
        }

        public void CopyFrom(Address address)
        {
            Street = address.Street;
            City = address.City;
            State = address.State;
            PostCode = address.PostCode;
            Location.CopyFrom(address.Location);
        }
    }
}