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 GetCodeOwner(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 GetCurrentCode(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 CreateNewCode(long userId); /// /// Record a register info for a user. /// /// The newly-registered user. /// The introducer user id. /// The register code. /// The register time. /// The created register info. Task CreateRegisterInfo(long userId, long introducerId, 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 GetUserRegisterInfo(long userId); /// /// Get the list of user register info of the specified introducer. /// /// /// The list of user register info. Task> GetUserRegisterInfoOfIntroducer(long introducerId); } }