/*
* Copyright (C) 2026 Fluxer Contributors
*
* This file is part of Fluxer.
*
* Fluxer is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Fluxer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Fluxer. If not, see .
*/
import type {GuildID, UserID} from '@fluxer/api/src/BrandedTypes';
import type {UserRow} from '@fluxer/api/src/database/types/UserTypes';
import type {User} from '@fluxer/api/src/models/User';
export interface IUserAccountRepository {
create(data: UserRow): Promise;
upsert(data: UserRow, oldData?: UserRow | null): Promise;
patchUpsert(userId: UserID, patchData: Partial, oldData?: UserRow | null): Promise;
findUnique(userId: UserID): Promise;
findUniqueAssert(userId: UserID): Promise;
findByUsernameDiscriminator(username: string, discriminator: number): Promise;
findDiscriminatorsByUsername(username: string): Promise>;
findByEmail(email: string): Promise;
findByPhone(phone: string): Promise;
findByStripeSubscriptionId(stripeSubscriptionId: string): Promise;
findByStripeCustomerId(stripeCustomerId: string): Promise;
listUsers(userIds: Array): Promise>;
listAllUsersPaginated(limit: number, lastUserId?: UserID): Promise>;
getUserGuildIds(userId: UserID): Promise>;
addPendingDeletion(userId: UserID, pendingDeletionAt: Date, deletionReasonCode: number): Promise;
removePendingDeletion(userId: UserID, pendingDeletionAt: Date): Promise;
findUsersPendingDeletion(now: Date): Promise>;
findUsersPendingDeletionByDate(deletionDate: string): Promise>;
isUserPendingDeletion(userId: UserID, deletionDate: string): Promise;
scheduleDeletion(userId: UserID, pendingDeletionAt: Date, deletionReasonCode: number): Promise;
deleteUserSecondaryIndices(userId: UserID): Promise;
removeFromAllGuilds(userId: UserID): Promise;
updateLastActiveAt(params: {userId: UserID; lastActiveAt: Date; lastActiveIp?: string}): Promise;
updateSubscriptionStatus(
userId: UserID,
updates: {premiumWillCancel: boolean; computedPremiumUntil: Date | null},
): Promise<{finalVersion: number | null}>;
}