import type Accessor from "../../core/Accessor.js";

export interface ReplicaDefinitionProperties extends Partial<Pick<ReplicaDefinition, "creationDate" | "lastSyncDate" | "replicaFilters" | "replicaId" | "replicaName" | "replicaOwner" | "syncDirection">> {}

/**
 * A replica definition returned from a knowledge graph replica endpoint.
 *
 * @since 5.1
 */
export default class ReplicaDefinition extends Accessor {
  constructor(properties?: ReplicaDefinitionProperties);
  /** Date the replica was created. */
  accessor creationDate: Date | null | undefined;
  /** Date of the last replica sync. */
  accessor lastSyncDate: Date | null | undefined;
  /** Filters that define the replica scope. */
  accessor replicaFilters: ReplicaFilters | null | undefined;
  /** Unique identifier of the replica. */
  accessor replicaId: string | null | undefined;
  /** Name of the replica. */
  accessor replicaName: string | null | undefined;
  /** Owner of the replica. */
  accessor replicaOwner: string | null | undefined;
  /** Synchronization direction for the replica. */
  accessor syncDirection: ReplicaSyncDirection | null | undefined;
}

export interface ReplicaReference {}

export type ReplicaProvenanceOptions = {
    includeProvenance: true;
    includeSourceDocuments?: boolean;
} | { includeProvenance: false; };

export type ReplicaDocumentOptions = {
    includeConnectedDocuments: true;
    includeDocumentProvenance: true;
    includeDocumentSourceDocuments?: boolean;
} | {
    includeConnectedDocuments: true;
    includeDocumentProvenance?: false;
} | { includeConnectedDocuments: false; };

export interface ReplicaNamedTypeDefinition {}

export interface ReplicaEntityTypeDefinition extends ReplicaNamedTypeDefinition {}

export interface ReplicaRelationshipTypeDefinition extends ReplicaNamedTypeDefinition {}

export interface ReplicaStaticDefinition {}

export interface ReplicaFilters {}

export type ReplicaSyncDirection = "bidirectional" | "upload" | "download";

export type ReplicaSyncDataFormat = "pbf" | "spbf" | "geoparquet" | "sqlite";

/** Base options shared by replica create request variants. */
export interface BaseReplicaOptions {
  /** Requested name to use when creating the replica. */
  requestedReplicaName: string;
  /** Optional requested replica id in UUID string format. */
  requestedReplicaId?: string;
  /** Synchronization direction for the replica operation. */
  syncDirection: ReplicaSyncDirection;
  /** Data format to use for replica synchronization payloads. */
  syncDataFormat: ReplicaSyncDataFormat;
  /** The type of the replica creation options */
  type: "reference" | "filter";
}

/** Additional options used by [executeCreateReplica()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeCreateReplica) for reference replica creation. */
export interface ReferenceReplicaOptions extends BaseReplicaOptions {
  /** Reference replica used as a create baseline. */
  referenceReplica: ReplicaReference;
  /** The type of the replica creation options */
  type: "reference";
}

/** Additional options used by [executeCreateReplica()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeCreateReplica) for filtered replica creation. */
export interface FilterReplicaOptions extends BaseReplicaOptions {
  /** filters to define the replica scope. */
  replicaFilters: ReplicaFilters;
  /** The type of the replica creation options */
  type: "filter";
}