using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Web;
using System.IO;
using System.Net.Mail;

using EQNetwork.Objects;
using EQNetwork.Utility;

namespace EQNetwork.Interfaces
{
    public partial interface IEQApiService
    {
        // non-blocking versions

        EQTask Session_Create(string username, string password, Action<Session, EQException> onComplete);
        EQTask Session_CreateFromFacebook(string fbAccessToken, DateTime fbExpirationDate, string email, Action<Session, EQException> onComplete);
        EQTask Session_CreateFromFacebook(string code, string redirect_Url, string email, Action<Session, EQException> onComplete);
        EQTask Session_CreateFromTwitter(string twUserId, string twScreenName, string twOAuthToken, string twOAuthTokenSecret, string email, Action<Session, EQException> onComplete);
        EQTask Session_Check(Guid sessionGuid, Action<Session, EQException> onComplete);

        EQTask User_Get(int userId, Action<User, EQException> onComplete);
        EQTask User_Get(string username, Action<User, EQException> onComplete);
        EQTask User_Get(Action<User, EQException> onComplete);

        EQTask User_Create(User user, Action<User, EQException> onComplete);
        EQTask User_AcceptEmailConfirmation(Guid confirmationGuid, Action<User, Guid, EQException> onComplete);

        EQTask User_Update(User user, Action<User, EQException> onComplete);
        EQTask User_UpdateFacebook(bool? isLinked, string accessToken, DateTime? expirationDate, Action<User, EQException> onComplete);
        EQTask User_UpdateTwitter(bool? isLinked, string twitterUserId, string screenName, string oAuthToken, string oAuthTokenSecret, Action<User, EQException> onComplete);

        EQTask User_Delete(Action<EQException> onComplete);
        EQTask User_Delete(User user, Action<EQException> onComplete);
        EQTask User_Delete(int userId, Action<EQException> onComplete);

        EQTask User_EmailAccounts(string email, Action<string, EQException> onComplete);

        EQTask User_ListCollections(
            ListCollectionsContext listCollectionsContext,
            PagingParameters pagingParameters,
            Action<List<Collection>, bool, EQException> onComplete);
        EQTask User_ListCollections(int? userId,
            ListCollectionsContext listCollectionsContext,
            PagingParameters pagingParameters,
            Action<List<Collection>, bool, EQException> onComplete);

        EQTask User_Search(string search, PagingParameters pagingParameters, Action<List<User>, bool, EQException> onComplete);
        EQTask User_ListUser(ListUsersContext listUsersContext, PagingParameters pagingParameters, Action<List<User>, bool, EQException> onComplete);
        EQTask User_ListFavoritedContentFiles(
            ListContentFilesContext listContentFilesContext,
            PagingParameters pagingParameters,
            Action<List<ContentFile>, bool, EQException> onComplete);

        EQTask User_RequestPasswordReset(string username, Action<EQException> onComplete);
        EQTask User_ResendConfirmationEmail(Action<EQException> onComplete);
        EQTask User_ResetPassword(Guid passwordResetGuid, string password, Action<EQException> onComplete);

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

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

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

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

        EQTask Collection_Get(int collectionId, Action<Collection, EQException> onComplete);
        EQTask Collection_Get(Guid collectionGuid, Action<Collection, EQException> onComplete);

        EQTask Collection_Create(Collection collection, Action<Collection, EQException> onComplete);

        EQTask Collection_Update(Collection collection, Action<Collection, EQException> onComplete);

        EQTask Collection_Delete(Collection collection, Action<EQException> onComplete);
        EQTask Collection_Delete(int collectionId, Action<EQException> onComplete);

        EQTask Collection_ListContentFiles(int collectionId,
            ListContentFilesContext listContentFilesContext,
            PagingParameters pagingParameters,
            Action<List<ContentFile>, bool, EQException> onComplete);

        EQTask Collection_AddRelationship(int collectionId, Db.User_CollectionType user_CollectionType, Action<EQException> onComplete);
        EQTask Collection_AddRelationship(int collectionId, Db.User_CollectionType user_CollectionType,
            int? collectionTriggerId, bool? silent, Action<EQException> onComplete);

        EQTask Collection_SocialAdd(int collectionId, string action, Db.SocialService? exclude, bool? force, Action<EQException> onComplete);
        EQTask Collection_SocialRemove(int collectionId, string action, bool? force, Action<EQException> onComplete);

        EQTask Collection_Viewed(int collectionId, Action<EQException> onComplete);

        EQTask ContentFile_Get(int contentFileId, Action<ContentFile, EQException> onComplete);
        EQTask ContentFile_Get(string filename, Action<ContentFile, EQException> onComplete);

        EQTask ContentFile_Create(ContentFile contentFile, Action<ContentFile, EQException> onComplete);
        EQTask ContentFile_CreateFromUrl(ContentFile contentFile, string url, Action<ContentFile, EQException> onComplete);

        EQTask ContentFile_Update(ContentFile contentFile, Action<ContentFile, EQException> onComplete);
        EQTask ContentFile_UpdateSortBy(int contentFileId, float? sortBy, Action<EQException> onComplete);

        EQTask ContentFile_Delete(ContentFile contentFile, Action<EQException> onComplete);
        EQTask ContentFile_Delete(int contentFileId, Action<EQException> onComplete);

        EQTask ContentFile_ChangeCollection(int contentFileId, int old_CollectionId, int new_CollectionId, Action<EQException> onComplete);
        EQTask ContentFile_FlagAsInappropriate(int contentFileId, Action<EQException> onComplete);

        EQTask ContentFile_ListPosts(string filename, PagingParameters pagingParameters, Action<List<Post>, bool, EQException> onComplete);

        EQTask ContentFile_SocialAdd(int contentFileId, string action, Db.SocialService? exclude, bool? force, Action<EQException> onComplete);
        EQTask ContentFile_SocialRemove(int contentFileId, string action, bool? force, Action<EQException> onComplete);

        EQTask ContentFile_Viewed(int contentFileId, Action<EQException> onComplete);

        EQTask Activity_Create(string activity, string secondary, Action<EQException> onComplete);

        EQTask ContentMenu_List(DateTime? modifiedSince, Action<List<ContentMenu>, DateTime?, EQException> onComplete);

        EQTask Post_Get(int postId, Action<Post, EQException> onComplete);

        EQTask Post_Create(Post post, Action<Post, EQException> onComplete);

        EQTask Post_Update(Post post, Action<Post, EQException> onComplete);

        EQTask Post_Delete(Post post, Action<EQException> onComplete);
        EQTask Post_Delete(int postId, Action<EQException> onComplete);

        EQTask Invitation_Accept(Guid invitationGuid, Action<EQException> onComplete);
        EQTask Invitation_Confirm(Guid invitationGuid, Action<EQException> onComplete);
        EQTask Invitation_Create(InvitationContext invitationContext, Action<List<InvitationMessage>, EQException> onComplete);
        EQTask Invitation_Decline(Guid invitationGuid, Action<EQException> onComplete);
        EQTask Invitation_Delete(Guid invitationGuid, Action<EQException> onComplete);
        EQTask Invitation_ListInvitationsForCollection(int collectionId, Action<List<Invitation>, EQException> onComplete);
        EQTask Invitation_ListInvitationsForCollection(Guid collectionGuid, Action<List<Invitation>, EQException> onComplete);
        EQTask Invitation_ListInvitationsForUser(int userId, Action<List<Invitation>, EQException> onComplete);
        EQTask Invitation_ListInvitationsToMe(List<Db.InvitationType> invitationTypes, bool? all, Action<List<Invitation>, EQException> onComplete);
        EQTask Invitation_Resend(Guid invitationGuid, Action<EQException> onComplete);
        EQTask Invitation_Update(Guid invitationGuid, Action<EQException> onComplete);

        EQTask Request_Accept(Guid requestGuid, Action<EQException> onComplete);
        EQTask Request_Confirm(Guid requestGuid, Action<EQException> onComplete);
        EQTask Request_Create(RequestContext requestContext, Action<RequestMessage, EQException> onComplete);
        EQTask Request_Decline(Guid requestGuid, Action<EQException> onComplete);
        EQTask Request_Delete(Guid requestGuid, Action<EQException> onComplete);
        EQTask Request_ListRequestsForCollection(int collectionId, Action<List<Request>, EQException> onComplete);
        EQTask Request_ListRequestsForCollection(Guid collectionGuid, Action<List<Request>, EQException> onComplete);
        EQTask Request_ListRequestsForUser(int userId, Action<List<Request>, EQException> onComplete);
        EQTask Request_ListRequestsToMe(List<Db.RequestType> requestTypes, bool? all, Action<List<Request>, EQException> onComplete);
        EQTask Request_GetCollectionRequestGuid(int collectionId, Action<Guid, EQException> onComplete);
        EQTask Request_Update(Guid requestGuid, Action<EQException> onComplete);

        EQTask Search_CollectionAndContentFiles(SearchFilters searchFilters, PagingParameters pagingParameters, Action<List<Collection>, bool, EQException> onComplete);
        EQTask Search_ContentFiles(SearchFilters searchFilters, PagingParameters pagingParameters, Action<List<ContentFile>, bool, EQException> onComplete);
        EQTask Search_ContentFiles(string filename, Action<ContentFile, EQException> onComplete);

        EQTask Hashtag_Search(string search, PagingParameters pagingParameters, Action<List<Hashtag>, bool, EQException> onComplete);
        EQTask Hashtag_Trending(PagingParameters pagingParameters, Action<List<Hashtag>, bool, EQException> onComplete);
        EQTask Category_ListAll(Action<List<Category>, EQException> onComplete);

        EQTask Upload_Begin(UploadContext uploadContext, Action<Upload, EQException> onComplete);
        EQTask Upload_Complete(UploadContext uploadContext, Action<Upload, EQException> onComplete);
        EQTask Upload_ListUploads(int preferredChunkSize, int numberOfChunks, Action<List<Upload>, EQException> onComplete);
        EQTask Upload_ListUpload(UploadContext uploadContext, Action<Upload, EQException> onComplete);
        EQTask Upload_Chunk(UploadContext uploadContext, long chunkOffset, long chunkSize, FileUploadSpec chunk, Action<long, long, EQException> onComplete);
        EQTask Upload_CancelUpload(UploadContext uploadContext, Action<Upload, EQException> onComplete);
        EQTask Upload_CreateContentFile(ContentFile contentFile, UploadContext uploadContext, Action<ContentFile, EQException> onComplete);
    }
}
