import { createAction, props } from '@ngrx/store';

import { Dashboard } from '../model/Dashboard';

export const addDashboard = createAction(
  '[Dashboard] Add Dashboard',
  props<{ dashboard: Dashboard }>()
);

export const addDashboardSuccess = createAction(
  '[Dashboard] Add Dashboard Success',
  props<{ dashboard: Dashboard }>()
);

export const addDashboardFailure = createAction(
  '[Dashboard] Add Dashboard Failure',
  props<{ dashboard: Dashboard; error: any }>()
);

export const loadDashboards = createAction('[Dashboard] Load Dashboards');

export const loadDashboardsSuccess = createAction(
  '[Dashboard] Load Dashboards Success',
  props<{ dashboards: Dashboard[] }>()
);

export const loadDashboardsFailure = createAction(
  '[Dashboard] Load Dashboards Failure',
  props<{ error: any }>()
);

export const modifyDashboard = createAction(
  '[Dashboard] Modify Dashboard',
  props<{ dashboard: Dashboard }>()
);

export const modifyDashboardSuccess = createAction(
  '[Dashboard] Modify Dashboard Success',
  props<{ dashboard: Dashboard }>()
);

export const modifyDashboardFailure = createAction(
  '[Dashboard] Modify Dashboard Failure',
  props<{ dashboard: Dashboard; error: any }>()
);

export const removeDashboard = createAction(
  '[Dashboard] Remove Dashboard',
  props<{ id: number }>()
);

export const removeDashboardSuccess = createAction(
  '[Dashboard] Remove Dashboard Success',
  props<{ id: number }>()
);

export const removeDashboardFailure = createAction(
  '[Dashboard] Remove Dashboard Failure',
  props<{ id: number; error: any }>()
);
