package dev.lions.user.manager.server.impl.repository;

import dev.lions.user.manager.server.impl.entity.SyncedUserEntity;
import io.quarkus.hibernate.orm.panache.PanacheRepository;
import jakarta.enterprise.context.ApplicationScoped;

import java.util.List;

@ApplicationScoped
public class SyncedUserRepository implements PanacheRepository<SyncedUserEntity> {

    /**
     * Remplace l'ensemble des snapshots d'utilisateurs pour un realm donné.
     */
    public void replaceForRealm(String realmName, List<SyncedUserEntity> users) {
        delete("realmName", realmName);
        persist(users);
    }
}

