using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using EQNetwork.Objects;
using EQNetwork.Utility;
using EQNetwork.Aspects;

namespace EQNetwork.Interfaces
{
    public partial interface IUserService
    {
        /// <summary>
        /// Get User information (by UserId)
        /// Returns User object (very limited info if not logged in, else still somewhat limited)
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="onComplete"></param>
        EQTask Get(int userId, Action<User, EQException> onComplete);

        /// <summary>
        /// Get User information (by Username)
        /// Returns User object (very limited info if not logged in, else still somewhat limited)
        /// </summary>
        /// <param name="username"></param>
        /// <param name="onComplete"></param>
        EQTask Get(string username, Action<User, EQException> onComplete);

        /// <summary>
        /// Get logged in User information
        /// Returns User object (fairly complete info... all except password)
        /// </summary>
        /// <param name="onComplete"></param>
        EQTask Get(Action<User, EQException> onComplete);

        /// <summary>
        /// Create a User
        /// Returns a Session object (essentially logs in the new User)
        /// </summary>
        /// <param name="user"></param>
        /// <param name="onComplete"></param>

        /// <summary>
        /// Update a User (only updates fields that have been modified in User object)
        /// Returns updated User object
        /// </summary>
        /// <param name="user"></param>
        /// <param name="onComplete"></param>
        EQTask Update(User user, Action<User, EQException> onComplete);

        /// <summary>
        /// Upload a User icon
        /// Returns updated User object (filename will have changed)
        /// </summary>
        /// <param name="path">File path</param>
        /// <param name="onComplete"></param>
        EQTask UploadIcon(string path, Action<User, EQException> onComplete);

        /// <summary>
        /// Upload a User icon
        /// Returns updated User object (filename will have changed)
        /// </summary>
        /// <param name="fileUploadSpec">Can be a path, a stream, or a url</param>
        /// <param name="onComplete"></param>
        EQTask UploadIcon(FileUploadSpec fileUploadSpec, Action<User, EQException> onComplete);

        /// <summary>
        /// Delete a User icon
        /// Returns updated User object (filename will be null)
        /// </summary>
        /// <param name="onComplete"></param>
        EQTask DeleteIcon(Action<User, EQException> onComplete);

        /// <summary>
        /// Link logged in User to a Facebook account
        /// Returns updated User object (filename will be null)
        /// </summary>
        /// <param name="accessToken">Facebook Access Token</param>
        /// <param name="expirationDate">Facebook Expiration Date</param>
        /// <param name="onComplete"></param>
        EQTask LinkFacebook(string accessToken, DateTime expirationDate, Action<User, EQException> onComplete);

        /// <summary>
        /// Unlink logged in User from Facebook account
        /// Returns updated User object
        /// </summary>
        /// <param name="onComplete"></param>
        EQTask UnlinkFacebook(Action<User, EQException> onComplete);

        /// <summary>
        /// Link logged in User to a Twitter account
        /// Returns updated User object
        /// </summary>
        /// <param name="twitterUserId">Twitter UserId</param>
        /// <param name="screenName">Twitter ScreenName</param>
        /// <param name="oAuthToken">Twitter OAuth Token</param>
        /// <param name="oAuthTokenSecret">Twither OAuth Token Secret</param>
        /// <param name="onComplete"></param>
        EQTask LinkTwitter(string twitterUserId, string screenName, string oAuthToken, string oAuthTokenSecret, Action<User, EQException> onComplete);

        /// <summary>
        /// Unlink logged User from Twitter account
        /// Returns updated User object
        /// </summary>
        /// <param name="onComplete"></param>
        EQTask UnlinkTwitter(Action<User, EQException> onComplete);

        /// <summary>
        /// Delete the logged in User's account
        /// </summary>
        /// <param name="onComplete"></param>
        EQTask Delete(Action<EQException> onComplete);

        /// <summary>
        /// Delete User (by User object)
        /// </summary>
        /// <param name="user">User object</param>
        /// <param name="onComplete"></param>
        EQTask Delete(User user, Action<EQException> onComplete);

        /// <summary>
        /// Delete User (by UserId)
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="onComplete"></param>
        EQTask Delete(int userId, Action<EQException> onComplete);

        /// <summary>
        /// Email a list of usernames associated with an email address *to* that email address (used for Forgot Username)
        /// </summary>
        /// <param name="email"></param>
        /// <param name="onComplete"></param>
        EQTask EmailAccounts(string email, Action<string, EQException> onComplete);

        /// <summary>
        /// List Collections for logged in User (Collection types and filters specified in ListCollectionsContext)
        /// </summary>
        /// <param name="listCollectionsContext">Collection types and filters</param>
        /// <param name="pagingParameters"></param>
        /// <param name="onComplete"></param>
        EQTask ListCollections(
            ListCollectionsContext listCollectionsContext,
            PagingParameters pagingParameters,
            Action<List<Collection>, bool, EQException> onComplete);

        /// <summary>
        /// List Collections for specified User (Collection types and filters specified in ListCollectionsContext)
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="listCollectionsContext">Collection types and filters</param>
        /// <param name="pagingParameters"></param>
        /// <param name="onComplete"></param>
        EQTask ListCollections(int userId,
            ListCollectionsContext listCollectionsContext,
            PagingParameters pagingParameters,
            Action<List<Collection>, bool, EQException> onComplete);

        /// <summary>
        /// Search for Users
        /// </summary>
        /// <param name="search">Search string (matches beginings of words)</param>
        /// <param name="pagingParameters"></param>
        /// <param name="onComplete"></param>
        EQTask Search(string search, PagingParameters pagingParameters, Action<List<User>, bool, EQException> onComplete);

        /// <summary>
        /// List Users being followed or contributed by the logged in User (types and filters specified in ListUsersContext)
        /// Will also list the Users following and contributing to the logged in User (ShowInverse in ListUserContext)
        /// </summary>
        /// <param name="listUsersContext"></param>
        /// <param name="pagingParameters"></param>
        /// <param name="onComplete"></param>
        EQTask ListUsers(ListUsersContext listUsersContext, PagingParameters pagingParameters, Action<List<User>, bool, EQException> onComplete);

        /// <summary>
        /// List the ContentFiles that have been favorited by the logged in User
        /// </summary>
        /// <param name="listContentFilesContext"></param>
        /// <param name="pagingParameters"></param>
        /// <param name="onComplete"></param>
        EQTask ListFavoritedContentFiles(
            ListContentFilesContext listContentFilesContext,
            PagingParameters pagingParameters,
            Action<List<ContentFile>, bool, EQException> onComplete);

        /// <summary>
        /// Sends an Email to the specified User with a Password Reset link
        /// </summary>
        /// <param name="username"></param>
        /// <param name="onComplete"></param>
        EQTask RequestPasswordReset(string username, Action<EQException> onComplete);

        /// <summary>
        /// Resends the confirmation email (first sent when User was created)
        /// </summary>
        /// <param name="onComplete"></param>
        EQTask ResendConfirmationEmail(Action<EQException> onComplete);

        /// <summary>
        /// Using the PasswordResetGuid sent int the RequestPasswordReset email... change the password
        /// </summary>
        /// <param name="passwordResetGuid"></param>
        /// <param name="password"></param>
        /// <param name="onComplete"></param>
        EQTask ResetPassword(Guid passwordResetGuid, string password, Action<EQException> onComplete);

        EQTask Purchase(PurchaseContext purchaseContext, Action<PurchaseTransaction, EQException> onComplete);

        EQTask FacebookFindFriends(string search, Db.SocialSearchType socialSearchType, PagingParameters pagingParameters, Action<List<Friend>, bool, EQException> onComplete);
        EQTask TwitterFindFriends(string search, Db.SocialSearchType socialSearchType, PagingParameters pagingParameters, Action<List<Friend>, bool, EQException> onComplete);

        EQTask UpdateSocial(bool isSocialOn, int fbBits, int twitterBits, Action<User, EQException> onComplete);

        EQTask SocialAdd(string action, int? collectionId, int? contentFileId, bool force, Action<EQException> onComplete);
        EQTask SocialRemove(string action, int? collectionId, int? contentFileId, bool force, Action<EQException> onComplete);

    }

}
