using System;

namespace Wayne.Lib.IO
{
    /// <summary>
    /// Interface.
    /// </summary>
    public interface IPaths
    {
        #region Properties

        /// <summary>
        /// The root path used by Wayne applications.
        /// </summary>
        string Root { get; }

        /// <summary>
        /// The base path to all config files.
        /// </summary>
        string Config { get; }

        /// <summary>
        /// The base path to all transaction files.
        /// </summary>
        string Transactions { get; }

        /// <summary>
        /// The base path to all log files.
        /// </summary>
        string Log { get; }

        /// <summary>
        /// The complete path (including the file name) to the executable.
        /// </summary>
        string ExecutablePath { get;  }

        /// <summary>
        /// The directory path to the executable.
        /// </summary>
        string ExecutableDirectory { get;  }

        /// <summary>
        /// The base path to data files.
        /// </summary>
        string Data { get;  }

        #endregion

        #region Methods

        /// <summary>
        /// Combines the Root path and the given subPath.
        /// </summary>
        /// <param name="subPath">The sub path (under the main path).</param>
        /// <returns></returns>
        string Combine(string subPath);

        /// <summary>
        /// Combines the Root path and the given subPath and file name.
        /// </summary>
        /// <param name="subPath">The sub path (under the main path).</param>
        /// <param name="subPath2">An additional sub path (or the name of a file).</param>
        /// <returns></returns>
        string Combine(string subPath, string subPath2);

        /// <summary>
        /// Returns the config path to the given config name.
        /// </summary>
        /// <param name="configName">The name of the config.</param>
        /// <returns></returns>
        string GetConfigPath(string configName);

        /// <summary>
        /// Returns the config path to the given config name.
        /// </summary>
        /// <param name="configName">The name of the config.</param>
        /// <param name="fileName">The name of a config file.</param>
        /// <returns></returns>
        string GetConfigPath(string configName, string fileName);

        /// <summary>
        /// Returns the transaction file path to the given terminal type.
        /// </summary>
        /// <param name="terminalType">The name of the terminal type.</param>
        /// <returns></returns>
        string GetTransactionsPath(string terminalType);

        /// <summary>
        /// Returns the transaction file path to the given terminal type.
        /// </summary>
        /// <param name="terminalType">The name of the terminal type.</param>
        /// <param name="subState">The name of the sub state.</param>
        /// <returns></returns>
        string GetTransactionsPath(string terminalType, string subState);

        /// <summary>
        /// Replaces the extension of a file (e.g. from C:\MyFile.aaa to C:\MyFile.bbb)
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="newExtension"></param>
        /// <returns></returns>
        string ReplaceExtension(string fileName, string newExtension);

        #endregion
        #region Parse
        /// <summary>
        /// Parses the path to replace any %...% variables with the current actual path.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        string Parse(string path);

        /// <summary>
        /// Checks if file exists
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        [Obsolete("Use the DirectoryExists() in FileSupport instead!")]
        bool FileExists(string fileName);

        /// <summary>
        /// Checks if directory exists
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        [Obsolete("Use the DirectoryExists() in FileSupport instead!")]
        bool DirectoryExists(string path);

        /// <summary>
        /// Ensures the directory exists by trying to create it if it does not exist already.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        [Obsolete("Use the DirectoryExists() in FileSupport instead!")]
        bool EnsureDirectoryExists(string path);

        #endregion
    }
}