package org.mercury_im.messenger.core.data.repository;

import org.jivesoftware.smackx.ikey.record.IkeyRecord;
import org.jxmpp.jid.EntityBareJid;
import org.mercury_im.messenger.entity.Account;

import java.util.UUID;

import io.reactivex.Completable;
import io.reactivex.Observable;

public interface IkeyRecordRepository {

    default Observable<IkeyRecord> loadRecord(Account account, EntityBareJid jid) {
        return loadRecord(account.getId(), jid);
    }

    Observable<IkeyRecord> loadRecord(UUID accountId, EntityBareJid jid);

    default Completable storeRecord(Account account, EntityBareJid jid, IkeyRecord record) {
        return storeRecord(account.getId(), jid, record);
    }

    Completable storeRecord(UUID accountId, EntityBareJid jid, IkeyRecord record);

    default Observable<IkeyRecord> loadContenderRecord(Account account, EntityBareJid jid) {
        return loadContenderRecord(account.getId(), jid);
    }

    Observable<IkeyRecord> loadContenderRecord(UUID accountId, EntityBareJid jid);

    default Completable storeContenderRecord(Account account, EntityBareJid jid, IkeyRecord contenderRecord) {
        return storeContenderRecord(account.getId(), jid, contenderRecord);
    }

    Completable storeContenderRecord(UUID accountId, EntityBareJid jid, IkeyRecord contenderRecord);

    default Completable clearContenderRecord(Account account, EntityBareJid jid) {
        return clearContenderRecord(account.getId(), jid);
    }

    Completable clearContenderRecord(UUID accountId, EntityBareJid jid);
}
