import { EVENT_POST, IWebhook } from '../Webhooks';
import { IExecutionWorker } from '../ExecutionWorkers';

export declare enum QUEUE_ENTRY_STATUS {
    READY_TO_SENT = 0,// indicates that the entry can be sent
    SUCCESS = 1,// entry was handled successfully
    FINALLY_FAILED = 2,// amount of tries reached the max amount, this entry needs to be handled manually by the user
    PRE_REMOVE = 3
}
export type CHANGE_SET = object;
export interface IExecutionQueue {
    /** primary identifier */
    id: string;
    /** the associated webhook */
    webhook: IWebhook;
    /** which execution worker handles this entry */
    executionWorker: IExecutionWorker;
    /** indicates the status of the entry, if it is ready to be sent, was successfully sent or failed finally, see const for the values */
    entryStatus: QUEUE_ENTRY_STATUS;
    /** the type of event related to this execution, see const and enum */
    event: EVENT_POST;
    /** the change set of the given entity */
    changeSet: CHANGE_SET;
    /** ChangeSet after merged native and DataHub changes and translated to attribute keys */
    preparedChangeSet: CHANGE_SET;
    /** json encoded entity related to the webhook execution */
    entity: string;
    /** current amount of tries of the execution (max: 5) */
    tries: number;
    /** DateTime when the execution was performed, null if no execution was performed so far */
    executeTime: string;
    /** DateTime when this execution should be performed */
    executeAfter: string;
    /** DateTime when this item was created */
    submittedAt: string;
    /** the id of the user who triggered this */
    submittedBy: number;
    /** the name of the user who triggered this */
    submittedByUsername: string;
}
