using System;
using System.Collections.Generic;

namespace NHibernateHacking {
    public class Customer {
        public Customer() {
            orders = new List<Order>();
        }

        public virtual Guid Id { get; protected set; }
        public virtual string Name { get; set; }
        private readonly IList<Order> orders;
        public virtual IEnumerable<Order> Orders {
            get { return orders; }
        }

        public virtual void AddOrder(Order order) {
            orders.Add(order);
            order.Customer = this;
        }

        public override string ToString() {
            return string.Format("Id: {0}, Name: {1}", Id, Name);
        }
    }

    public class Order {
        public Order() {
            LineItems = new List<LineItem>();
        }
        public virtual Guid Id { get; set; }
        public virtual IList<LineItem> LineItems { get; set; }
        public virtual Customer Customer { get; set; }
    }

    public class LineItem {
        public virtual Guid Id { get; set; }
    }
}