#region Copyright and GPL
/*************************************************************************
 * dataMagus - The open source database learning software
 * Copyright (C) 2007 by all authors
 * Authors: Monika Schwitter (monsy@gmx.ch)
 *          Jürg Zgraggen (j.zgraggen@ejaz.net)
 *          HSLU (Hochschule Luzern - Technik+Architektur)
 * 
 *     This program is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 * 
 *     You should have received a copy of the GNU General Public License
 *     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *************************************************************************/
#endregion
#region Using
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.Windows.Forms;
using dataMagus.Common.Physical;
#endregion

namespace dataMagus.Common.PlugIn.Generator
{
	/// <summary>
	/// Root interface for physical generators.
	/// </summary>
    public interface IGenerator
    {
        #region Properties
        /// <summary>
        /// Name of the generator.
        /// </summary>
        string Name { get; }
        
        /// <summary>
        /// Clone of the schema to be generated.
        /// </summary>
        ISchema Schema { set; }
        
        /// <summary>
        /// Extended data from the generator.
        /// </summary>
        IExtendedData ExtendedData { get; }
        #endregion

        #region Methodes
        /// <summary>
        /// Generate source code into a stream.
        /// </summary>
        /// <param name="stream">Stream to generate in.</param>
        void Generate(Stream stream);
        
        /// <summary>
        /// Clean all extended generator data.
        /// </summary>
        /// <param name="schema">Schema to clean the data for.</param>
        void CleanExtendedData(IPhysicalSchema schema);
        
        /// <summary>
        /// Update a datatype on the schema.
        /// </summary>
        /// <param name="newDatatype">New datatype.</param>
        /// <param name="oldDatatype">Old datatype.</param>
        /// <param name="action">Action happend.</param>
        void UpdateDataType(DataType newDatatype, DataType oldDatatype, dataMagus.Common.Physical.PhysicalItemContainer.DataTypeAction action);
        
        /// <summary>
        /// Get the generator control for the options tab on the generator dialog.
        /// </summary>
        /// <returns>Instance of a generator control.</returns>
        GeneratorControl GetGeneratorOptionDataControl();
        
        /// <summary>
        /// Get the generator control for the datatype mapping.
        /// </summary>
        /// <returns>Instance of a generator control.</returns>
        GeneratorControl GetGeneratorDataTypeMappingsControl();
        
        /// <summary>
        /// Get the generator control for the extended schema data.
        /// </summary>
        /// <param name="schema">Schema to store the extended data for.</param>
        /// <returns>Instance of a generator control.</returns>
        GeneratorControl GetExtendedSchemaDataControl(IPhysicalSchema schema);
        #endregion
    }
}
