var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
export class AgentSyncApi {
    constructor({ agent, syncEngine }) {
        this._syncEngine = syncEngine;
        this._agent = agent;
    }
    /**
     * Retrieves the `Web5PlatformAgent` execution context.
     *
     * @returns The `Web5PlatformAgent` instance that represents the current execution context.
     * @throws Will throw an error if the `agent` instance property is undefined.
     */
    get agent() {
        if (this._agent === undefined) {
            throw new Error('AgentSyncApi: Unable to determine agent execution context.');
        }
        return this._agent;
    }
    set agent(agent) {
        this._agent = agent;
        this._syncEngine.agent = agent;
    }
    get connectivityState() {
        return this._syncEngine.connectivityState;
    }
    registerIdentity(params) {
        return __awaiter(this, void 0, void 0, function* () {
            yield this._syncEngine.registerIdentity(params);
        });
    }
    unregisterIdentity(did) {
        return __awaiter(this, void 0, void 0, function* () {
            yield this._syncEngine.unregisterIdentity(did);
        });
    }
    getIdentityOptions(did) {
        return __awaiter(this, void 0, void 0, function* () {
            return yield this._syncEngine.getIdentityOptions(did);
        });
    }
    updateIdentityOptions(params) {
        return __awaiter(this, void 0, void 0, function* () {
            yield this._syncEngine.updateIdentityOptions(params);
        });
    }
    sync(direction) {
        return this._syncEngine.sync(direction);
    }
    startSync(params) {
        return this._syncEngine.startSync(params);
    }
    stopSync(timeout) {
        return this._syncEngine.stopSync(timeout);
    }
}
//# sourceMappingURL=sync-api.js.map