using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Timeline.Entities;
namespace Timeline.Services.User.RegisterCode
{
    public interface IRegisterCodeService
    {
        /// 
        /// Get the owner of a register code or null if the code does not exist or is not enabled.
        /// 
        /// The register code.
        /// If true, only when code is enabled the owner id is returned.
        /// A task contains the owner of the register code. Null of the code does not exist or is not enabled.
        Task GetCodeOwnerAsync(string code, bool onlyEnabled = true);
        /// 
        /// Get the current enabled register code of the user or null if there is none.
        /// 
        /// The user id.
        /// A task contains current enabled register code or null if there is none.
        Task GetCurrentCodeAsync(long userId);
        /// 
        /// Create a new register code for a user, enable it and disable the previous one if there is a previous one.
        /// 
        /// The user id.
        /// A task contains the new register code.
        Task CreateNewCodeAsync(long userId);
        /// 
        /// Record a register info for a user.
        /// 
        /// The newly-registered user.
        /// The register code.
        /// The register time.
        /// The created register info.
        Task CreateRegisterInfoAsync(long userId, string registerCode, DateTime registerTime);
        /// 
        /// Get register info of a user if there is one.
        /// 
        /// The user id.
        /// The user register info if there is one. Or null if there is not.
        Task GetUserRegisterInfoAsync(long userId);
        /// 
        /// Create a user with register code.
        /// 
        /// The params to create user with.
        /// The user code.
        /// The created user.
        /// Thrown when  or  is null.
        /// Thrown when  is invalid.
        /// Thrown when username already exist.
        /// Thrown when register code is invalid.
        Task RegisterUserWithCode(CreateUserParams userParams, string registerCode);
        /// 
        /// Get the list of user register info of the specified introducer.
        /// 
        /// 
        /// The list of user register info.
        Task> GetUserRegisterInfoOfIntroducerAsync(long introducerId);
    }
}