using System;
using System.Collections.Generic;
using System.IO;

namespace InABox.Core
{
    public delegate void ImportNotificationEvent(object sender, string message);

    public delegate bool ImportPreProcessEvent(object sender, Dictionary<string, string> values);

    public delegate bool ImportPostProcessEvent(object sender, object entity, Dictionary<string, string> values);

    public delegate void ImportSaveEvent(object sender, object entity);

    public delegate CoreTable ImportLoadEvent(object sender, Type type, String[] fields, String ID);
    
    public interface IImporter
    {
        string[] Properties { get; }

        string[] Fields { get; }

        bool HasHeader { get; set; }

        int HeaderRow { get; set; }

        List<ImportMapping> Mappings { get; }

        IEnumerable<string> Log { get; }
        event ImportNotificationEvent OnNotify;

        event ImportPreProcessEvent BeforeProcess;
        event ImportPostProcessEvent AfterProcess;
        event ImportSaveEvent OnSave;
        event ImportLoadEvent OnLoad;

        bool Open(Stream stream);

        void Close();

        int Import();

        bool MoveNext();

        bool ReadHeader();

        Dictionary<string, string> ReadLine();
    }
}