using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.ActiveRecord;
using Castle.ActiveRecord.Framework;
using Castle.ActiveRecord.Framework.Config;
using System.Reflection;

namespace Inheritance2Example
{
    [ActiveRecord]
    public class KlasaBazowa : ActiveRecordBase
    {
        [PrimaryKey]
        public int ID { get; set; }
        [Property]
        public string ModifiedBy { get; set; }
    }

    [ActiveRecord, JoinedBase]
    public class Osoba : KlasaBazowa
    {
        [Property]
        public string ImieNazwisko { get; set; }
    }

    [ActiveRecord, JoinedBase]
    public class Pracownik : Osoba
    {
        [JoinedKey]
        public int ID { get; set; }
        [Property]
        public string Stanowisko { get; set; }
    }

    [ActiveRecord]
    public class Nauczyciel : Pracownik
    {
        [JoinedKey]
        public int ID { get; set; }
        [Property]
        public bool Wychowawca { get; set; }
    }

    class Program
    {
        static void Main( string[] args )
        {
            IConfigurationSource source = ActiveRecordSectionHandler.Instance;
            ActiveRecordStarter.Initialize( Assembly.GetAssembly( typeof( Program ) ), source );
            ActiveRecordStarter.DropSchema();
            ActiveRecordStarter.CreateSchema();

            var Nauczyciel = new Nauczyciel { ImieNazwisko = "Jan Kowalski", Stanowisko = "Mianowany", Wychowawca = false, ModifiedBy = "Admin" };
            Nauczyciel.Save();
            var ProstyWiersz = new KlasaBazowa { ModifiedBy = "Paweł" };
            ProstyWiersz.Save();
        }
    }
}
