package scripting;

import org.cresques.cts.IProjection;
import org.gvsig.fmap.dal.DataStore;
import org.gvsig.fmap.dal.feature.FeatureType;
import org.gvsig.fmap.mapcontext.layers.FLayer;
import org.gvsig.scripting.app.extension.ScriptingExtension;

/**
 * Representa al modulo python "gvsig".
 *
 * Es el modulo base que nos facilita el acceso a todos los componentes de
 * gvSIG.
 *
 */
public class gvsig {

    public static int LOGGER_INFO = ScriptingExtension.INFO;
    public static int LOGGER_WARN = ScriptingExtension.WARN;
    public static int LOGGER_ERROR = ScriptingExtension.ERROR;

    /**
     * Returns a new and empty attributes definition.
     *
     * @return the new FeatureType
     */
    public static FeatureType createFeatureType() {
        return null;
    }

    /**
     * Returns a new and empty attributes definition based in an existing
     * FeatureType.
     *
     * All attributes in the feature type pased as parameters are created in the
     * new definition
     *
     * @param featureType from the new attributes are copied
     * @return The new FeatureType
     */
    public static FeatureType createFeatureType(FeatureType featureType) {
        return null;
    }

    /**
     * Create a new layer with the specified parameters.
     *
     * The paramaters are used to connect to the server type and create the
     * layer. These parameters are specific of each type of layer.
     *
     * Valid values of server type are:
     * <ul>
     * <li>FilesystemExplorer</li>
     * <li>PostgreSQLExplorer</li>
     * <li>WFSServerExplorer</li>
     * <li>Wms Store</li>
     * <li>...</li>
     * </ul>
     *
     * Valid values of layer type are:
     * <ul>
     * <li>Shape</li>
     * <li>Dbf</li>
     * <li>DXF</li>
     * <li>DGN</li>
     * <li>DWG</li>
     * <li>JExcel</li>
     * <li>PostgreSQL</li>
     * <li>WFSStore</li>
     * <li>Gdal Store</li>
     * <li>...</li>
     * </ul>
     *
     * Excamples of use:<br>
     * <code>
     * TODO
     * </code>
     *
     * @param schema the schema to use to create la layer.
     * @param serverType The server type (filesystem, BBDD, ...)
     * @param layerType The layer type to create (Shape, ...)
     * @param parameters the specific parameters to create the new layer
     * @return the new created layer
     *
     */
    public static FLayer creaetLayer(FeatureType schema, String serverType, String layerType, Object... parameters) {
        return null;
    }

    /**
     * Create a new layer with the specified parameters.
     *
     * Use as default serverType the "FilesystemExplorer".
     *
     * @param schema
     * @param layerType
     * @param parameters
     * @return
     */
    public static FLayer creaetLayer(FeatureType schema, String layerType, Object... parameters) {
        return null;
    }

    /**
     * Load an existing shape file in the current view.
     *
     * @param path path to the shape file to load
     * @param projection to use to load the shape file
     * @return
     *
     */
    public static FLayer loadShapeFile(String path, String projection) {
        return null;
    }

    /**
     * Load an existing shape file in the current view.
     *
     * Use as default projection "CRS:84"
     *
     * @param path path to the shape file to load
     * @return
     *
     */
    public static FLayer loadShapeFile(String path) {
        return null;
    }

    /**
     * Load an existing layer and return it.
     *
     * Valid values of layer type are: - Shape - TODO
     *
     * @param layerType
     * @param parameters
     * @return
     *
     */
    public static FLayer loadLayer(String layerType, Object... parameters) {
        return null;
    }

    /**
     * Send a message to the log system.
     *
     * The values of mode are:
     * <ul>
     * <li>LOGGER_INFO</li>
     * <li>LOGGER_WARN</li>
     * <li>LOGGER_ERROR</li>
     * </ul>
     *
     * @param msg to send to log
     * @param mode message type, is optional with defaul of LOGGER_INFO.
     * @param exception an exception to log, is optional.
     */
    public static void logger(String msg, int mode, Throwable exception) {

    }

    /**
     * Create the path to a resource.
     *
     * This function runs like the os.path.join, but if the first argument is a
     * full path name to a file, it only get the dirname of it.
     *
     * This is usefull to use with the variable __file__ as the first argument
     * to get a path name to a resource relative to the current module.
     *
     * Explample:<br>
     * <code>
     *  pathname = getResource(__file__,"data","icon.png")
     * </code>
     *
     * @param parameters parts of path to the resource.
     * @return the path name to the resource.
     */
    public String getResource(String... parameters) {
        return null;
    }

    /**
     * Open an existen data store an return it.
     *
     * The type of store depened of store to be opened. It can be:
     * <ul>
     * <li>Shape</li>
     * <li>Dbf</li>
     * <li>DXF</li>
     * <li>DGN</li>
     * <li>DWG</li>
     * <li>JExcel</li>
     * <li>PostgreSQL</li>
     * <li>WFSStore</li>
     * <li>Gdal Store</li>
     * </ul>
     *
     * @param storeType the type of store to open.
     * @param parameters to open the store.
     * @return the opened data store
     */
    public DataStore openStore(String storeType, Object... parameters) {
        return null;
    }
    
    /**
     * Create a new projectionobject associated with the passed name of 
     * the projection.
     * 
     * Usually, the name is the abbreviation of the projection.
     * 
     * Is preferable to use this method <code>CRSFactory.getCRS(name)</code> instead.
     * 
     * @param name abbreviation of the projection
     * @return the projection object associated with the name
     */
    public IProjection getCRS(String name) {
        return null;
    }
    
    /**
     * Return the default data folder of gvSIG.
     * This is configured in the preferences of gvSIG.
     * 
     * @return the data folder of gvSIG
     */
    public String getDataFolder() {
        return null;
    }
    
    /**
     * Return the default projects folder of gvSIG.
     * This is configured in the preferences of gvSIG.
     * 
     * @return the projects folder of gvSIG.
     */
    public String getProjectsFolder() {
        return null;
    }
}
