import { DSQL_DATASQUIREL_PROCESS_QUEUE } from "@/package-shared/types/dsql";

export type APIResponseObject<
    T extends { [k: string]: any } = { [k: string]: any }
> = {
    success: boolean;
    payload?: T;
    msg?: string;
    err?: string;
};

export const QueueJobTypes = ["dummy", "import-database"] as const;

export const WebSocketEvents = [
    /**
     * # Client Events
     * @description Events sent from Client to Server
     */
    "client:check-queue",
    "client:dev:queue",
    "client:delete-queue",

    /**
     * # Server Events
     * @description Events sent from Server to Client
     */
    "server:error",
    "server:message",
    "server:ready",
    "server:success",
    "server:update",
    "server:queue",
    "server:dev:queue",
    "server:queue-deleted",
] as const;

export type WebSocketDataType = {
    event: (typeof WebSocketEvents)[number];
    data?: {
        queue?: DSQL_DATASQUIREL_PROCESS_QUEUE;
    };
    error?: string;
    message?: string;
};

export const DatasquirelWindowEvents = [
    "queue-started",
    "queue-complete",
    "queue-running",
] as const;

export type DatasquirelWindowEventPayloadType = {
    event: (typeof DatasquirelWindowEvents)[number];
    data?: {
        queue?: DSQL_DATASQUIREL_PROCESS_QUEUE;
    };
    error?: string;
    message?: string;
};
