import { DidDocument } from "./domain/DidDocument.js";
import { DIDDocumentMetadata, DIDResolutionMetadata, DIDResolutionOptions, ParsedDID } from "did-resolver";

//#region src/modules/dids/types.d.ts
type ParsedDid = ParsedDID;
type DidDocumentMetadata = DIDDocumentMetadata;
interface DidResolutionOptions extends DIDResolutionOptions {
  /**
   * Whether to resolve the did document from the cache.
   *
   * @default true
   */
  useCache?: boolean;
  /**
   * Whether to resolve the did from a local created did document in a DidRecord.
   * Cache has precendence over local records, as they're often fater. Records
   * served from DidRecords will not be added to the cache.
   *
   * The resolver must have enabled `allowsLocalDidRecord` (default false) to use this
   * feature.
   *
   * @default true
   */
  useLocalCreatedDidRecord?: boolean;
  /**
   * Whether to persist the did document in the cache.
   *
   * @default true
   */
  persistInCache?: boolean;
  /**
   * How many seconds to persist the resolved document
   *
   * @default 3600
   */
  cacheDurationInSeconds?: number;
}
interface DidResolutionMetadata extends DIDResolutionMetadata {
  message?: string;
  /**
   * Whether the did document was served from the cache
   */
  servedFromCache?: boolean;
  /**
   * Whether the did document was served from a local did record
   */
  servedFromDidRecord?: boolean;
}
interface DidResolutionResult {
  didResolutionMetadata: DidResolutionMetadata;
  didDocument: DidDocument | null;
  didDocumentMetadata: DidDocumentMetadata;
}
type DidRegistrationExtraOptions = Record<string, unknown>;
type DidRegistrationSecretOptions = Record<string, unknown>;
type DidRegistrationMetadata = Record<string, unknown>;
type DidDocumentOperation = 'setDidDocument' | 'addToDidDocument' | 'removeFromDidDocument';
interface DidOperationStateFinished {
  state: 'finished';
  did: string;
  secret?: DidRegistrationSecretOptions;
  didDocument: DidDocument;
}
interface DidOperationStateFailed {
  state: 'failed';
  did?: string;
  secret?: DidRegistrationSecretOptions;
  didDocument?: DidDocument;
  reason: string;
}
interface DidOperationStateWait {
  state: 'wait';
  did?: string;
  secret?: DidRegistrationSecretOptions;
  didDocument?: DidDocument;
}
interface DidOperationStateActionBase {
  state: 'action';
  action: string;
  did?: string;
  secret?: DidRegistrationSecretOptions;
  didDocument?: DidDocument;
}
interface DidCreateOptions {
  method?: string;
  did?: string;
  options?: DidRegistrationExtraOptions;
  secret?: DidRegistrationSecretOptions;
  didDocument?: DidDocument;
}
interface DidCreateResult<DidOperationStateAction extends DidOperationStateActionBase = DidOperationStateActionBase> {
  jobId?: string;
  didState: DidOperationStateWait | DidOperationStateAction | DidOperationStateFinished | DidOperationStateFailed;
  didRegistrationMetadata: DidRegistrationMetadata;
  didDocumentMetadata: DidResolutionMetadata;
}
interface DidUpdateOptions {
  did: string;
  options?: DidRegistrationExtraOptions;
  secret?: DidRegistrationSecretOptions;
  didDocumentOperation?: DidDocumentOperation;
  didDocument: DidDocument | Partial<DidDocument>;
}
interface DidUpdateResult {
  jobId?: string;
  didState: DidOperationStateWait | DidOperationStateActionBase | DidOperationStateFinished | DidOperationStateFailed;
  didRegistrationMetadata: DidRegistrationMetadata;
  didDocumentMetadata: DidResolutionMetadata;
}
interface DidDeactivateOptions {
  did: string;
  options?: DidRegistrationExtraOptions;
  secret?: DidRegistrationSecretOptions;
}
interface DidDeactivateResult {
  jobId?: string;
  didState: DidOperationStateWait | DidOperationStateActionBase | DidOperationStateFinished | DidOperationStateFailed;
  didRegistrationMetadata: DidRegistrationMetadata;
  didDocumentMetadata: DidResolutionMetadata;
}
//#endregion
export { DidCreateOptions, DidCreateResult, DidDeactivateOptions, DidDeactivateResult, DidDocumentMetadata, DidDocumentOperation, DidOperationStateActionBase, DidOperationStateFailed, DidOperationStateFinished, DidOperationStateWait, DidRegistrationExtraOptions, DidRegistrationMetadata, DidRegistrationSecretOptions, DidResolutionMetadata, DidResolutionOptions, DidResolutionResult, DidUpdateOptions, DidUpdateResult, ParsedDid };
//# sourceMappingURL=types.d.ts.map