import '../common/abstract-api-provider.js';
import AbstractBaseModule from '../common/abstract-base-module.js';
import '../../../utils/types/array.js';
import 'crypto';
import { withExtendedPrototypeProperties } from '../../../utils/inheritance.js';
import 'bs58';
import 'multiformats/bases/base58';
import 'varint';
import '../../../utils/encoding/ss-58.js';
import '../../../utils/types/object.js';
import '../../../utils/types/iterable.js';
import '../../../utils/types/set.js';
import 'blake2b';
import '../../../utils/types/bytes.js';
import '../../../utils/interfaces.js';
import '../../../utils/assert.js';
import '../../../utils/error.js';
import '../../../utils/types/string.js';

/** Class to create, update and destroy DIDs */
class AbstractDIDModule extends AbstractBaseModule {
  /**
   * Creates a new DID document.
   * @param {DIDDocument} didDocument - The DID Document to be created.
   * @param {DidKeypair} didKeypair - The keypair used for signing the transaction.
   * @param {Object} params - Additional parameters for creating the document (optional).
   * @returns {Promise<*>} - A promise that resolves when the creation is complete.
   */
  async createDocument(didDocument, didKeypair, params) {
    return await this.signAndSend(
      await this.createDocumentTx(didDocument, didKeypair),
      params,
    );
  }

  /**
   * Updates an existing DID document.
   * @param {DIDDocument} didDocument - The updated DID Document.
   * @param {DidKeypair} didKeypair - The keypair used for signing the transaction.
   * @param {Object} params - Additional parameters for updating the document (optional).
   * @returns {Promise<*>} - A promise that resolves when the update is complete.
   */
  async updateDocument(didDocument, didKeypair, params) {
    return await this.signAndSend(
      await this.updateDocumentTx(didDocument, didKeypair),
      params,
    );
  }

  /**
   * Removes a DID document.
   * @param {DockDid} did - The ID of the DID to be removed.
   * @param {DidKeypair} didKeypair - The keypair used for signing the transaction.
   * @param {Object} params - Additional parameters for removing the document (optional).
   * @returns {Promise<*>} - A promise that resolves when the removal is complete.
   */
  async removeDocument(did, didKeypair, params) {
    return await this.signAndSend(
      await this.removeDocumentTx(did, didKeypair),
      params,
    );
  }

  /**
   * Retrieves a DID document by ID.
   * @param {DockDid} did - The ID of the DID to be retrieved.
   * @returns {Promise<DIDDocument>} - A promise that resolves with the requested DID Document.
   */
  async getDocument(_did) {
    throw new Error('Unimplemented');
  }

  /**
   * Generates a transaction to create a new DID document.
   * @param {DIDDocument} didDocument - The DID Document to be created.
   * @param {DidKeypair} didKeypair - The keypair used for signing the transaction.
   * @returns {Promise<*>} - A promise that resolves with the generated transaction.
   */
  async createDocumentTx(_didDocument, _didKeypair) {
    throw new Error('Unimplemented');
  }

  /**
   * Generates a transaction to update an existing DID document.
   * @param {DIDDocument} didDocument - The updated DID Document.
   * @param {DidKeypair} didKeypair - The keypair used for signing the transaction.
   * @returns {Promise<*>} - A promise that resolves with the generated transaction.
   */
  async updateDocumentTx(_didDocument, _didKeypair) {
    throw new Error('Unimplemented');
  }

  /**
   * Generates a transaction to remove an existing DID document.
   * @param {DockDid} did - The ID of the DID to be removed.
   * @param {DidKeypair} didKeypair - The keypair used for signing the transaction.
   * @returns {Promise<*>} - A promise that resolves with the generated transaction.
   */
  async removeDocumentTx(_did, _didKeypair) {
    throw new Error('Unimplemented');
  }
}

var AbstractDIDModule$1 = withExtendedPrototypeProperties(
  ['createDocumentTx', 'updateDocumentTx', 'removeDocumentTx', 'getDocument'],
  AbstractDIDModule,
);

export { AbstractDIDModule$1 as default };
//# sourceMappingURL=module.js.map
