/*
 * Copyright 2017 VMware, Inc. All rights reserved. VMware Confidential
 */
import { Action } from "@ngrx/store";
import { ExtensionEntityRegistration, ExtensionNavRegistration } from "../../models/extension";

export const ExtensionActionTypes = {
    REGISTER_EXTENSION_NAV: "[Extensions] Register Extension Navigation",
    REGISTER_EXTENSION_NAV_SUCCESS: "[Extensions] Register Extension Navigation Succeeded",
    REGISTER_EXTENSION_NAV_FAILURE: "[Extensions] Register Extension Navigation Failed",

    REGISTER_EXTENSION_ENTITY: "[Extensions] Register Extension Entity",
};

export class ExtensionNavRegistrationAction implements Action {
    readonly type = ExtensionActionTypes.REGISTER_EXTENSION_NAV;

    constructor(public payload: ExtensionNavRegistration) {}
}

export class ExtensionNavRegistrationSucceededAction implements Action {
    readonly type = ExtensionActionTypes.REGISTER_EXTENSION_NAV_SUCCESS;

    constructor(public payload: void) {}
}

export class ExtensionNavRegistrationFailedAction implements Action {
    readonly type = ExtensionActionTypes.REGISTER_EXTENSION_NAV_FAILURE;

    constructor(public payload: { messageCode: string }) {}
}

export class ExtensionEntityRegistrationAction implements Action {
    readonly type = ExtensionActionTypes.REGISTER_EXTENSION_ENTITY;

    constructor(public payload: ExtensionEntityRegistration) {}
}

export type ExtensionActions =
    | ExtensionNavRegistrationAction
    | ExtensionEntityRegistrationAction
    | ExtensionNavRegistrationFailedAction
    | ExtensionNavRegistrationSucceededAction;
