using SVSim.Database.Enums;

namespace SVSim.Database.Repositories.Viewer;

public interface IViewerRepository
{
    Task<Models.Viewer?> GetViewerBySocialConnection(SocialAccountType accountType, ulong socialId);
    Task<Models.Viewer?> GetViewerWithSocials(long id);
    Task<Models.Viewer?> GetViewerByShortUdid(long shortUdid);
    Task<Models.Viewer?> GetViewerByUdid(Guid udid);

    Task<Models.Viewer> RegisterViewer(string displayName, SocialAccountType socialType,
        ulong socialAccountIdentifier, ulong? shortUdid = null);
    Task<Models.Viewer> RegisterAnonymousViewer(Guid udid);
    Task LinkSteamToViewer(long viewerId, ulong steamId);

    /// <summary>
    /// Merges an anonymous viewer (just created by <c>/tool/signup</c> on a fresh UDID)
    /// into a target viewer that the Steam ticket resolved to. Transfers the anonymous
    /// viewer's UDID to the target, then deletes the anonymous viewer.
    /// </summary>
    Task MergeAnonymousViewerInto(long anonymousViewerId, long targetViewerId);

    /// <summary>
    /// Focused load for building a battle-node <c>MatchContext</c>: viewer + Info + Info's
    /// equipped Emblem/Degree nav refs. Read-only (AsNoTracking). Returns null if the viewer
    /// doesn't exist.
    /// </summary>
    Task<Models.Viewer?> LoadForMatchContextAsync(long viewerId);
}
