import type Accessor from "../../core/Accessor.js";
import type EsriError from "../../core/Error.js";
import type { ReplicaSyncDataFormat } from "./ReplicaDefinition.js";

export interface CreateReplicaResponseProperties extends Partial<Pick<CreateReplicaResponse, "asyncStatusUrl" | "createReplicaResult">> {}

/**
 * The response for [executeCreateReplica()](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/#executeCreateReplica).
 *
 * @since 5.1
 */
export default class CreateReplicaResponse extends Accessor {
  constructor(properties?: CreateReplicaResponseProperties);
  /** URL to check asynchronous status when replica creation runs asynchronously. */
  accessor asyncStatusUrl: string | null | undefined;
  /** Result payload when replica creation returns synchronously. */
  accessor createReplicaResult: CreateReplicaResult | null | undefined;
}

/** Result details returned for a completed replica creation request. */
export interface CreateReplicaResult {
  /** Errors returned by the replica creation operation. */
  errors: EsriError[];
  /** Warnings returned by the replica creation operation. */
  warnings: EsriError[];
  /** Name of the created replica. */
  replicaName: string;
  /** The requested replica name supplied on the create replica request. */
  requestedReplicaName: string;
  /** Unique identifier of the created replica. */
  replicaId: string;
  /** Sync date associated with the created replica. */
  syncDate?: Date | null;
  /** Sync data format of the created replica. */
  replicaDataFormat?: ReplicaSyncDataFormat;
  /** URL to fetch replica data. */
  replicaDataUrl: string;
}