import { Task } from './../model/task' ; import { Action } from '@ngrx/store' ; import { type } from './../../ngrx/util' ; export const ActionTypes = { LOAD : type ( '[Task] -LOAD Requested-' ) , LOAD_COMPLETED : type ( '[Task] -LOAD Completed-' ) , LOAD_ERROR : type ( '[Task] -LOAD Error-' ) , CREATE : type ( '[Task] -CREATE Requested-' ) , CREATE_COMPLETED : type ( '[Task] -CREATE Completed-' ) , CREATE_ERROR : type ( '[Task] -CREATE Error-' ) , UPDATE : type ( '[Task] -UPDATE Requested-' ) , UPDATE_COMPLETED : type ( '[Task] -UPDATE Completed-' ) , UPDATE_ERROR : type ( '[Task] -UPDATE Error-' ) , REMOVE : type ( '[Task] -REMOVE Requested-' ) , REMOVE_COMPLETED : type ( '[Task] -REMOVE Completed-' ) , REMOVE_ERROR : type ( '[Task] -REMOVE Error-' ) } ; export class TaskPayload { constructor ( public task ) { } } export class TaskUpdatePayload { constructor ( public taskId , public task ) { } } export class TaskRemovePayload { constructor ( public taskId ) { } } export class TasksPayload { constructor ( public tasks ) { } } export class LoadAction implements Action { type = ActionTypes . LOAD ; constructor ( public payload = null ) { } } export class LoadCompletedAction implements Action { type = ActionTypes . LOAD_COMPLETED ; constructor ( public payload ) { } } export class LoadErrorAction implements Action { type = ActionTypes . LOAD_ERROR ; constructor ( public payload ) { } } export class CreateAction implements Action { type = ActionTypes . CREATE ; constructor ( public payload ) { } } export class CreateCompletedAction implements Action { type = ActionTypes . CREATE_COMPLETED ; constructor ( public payload ) { } } export class CreateErrorAction implements Action { type = ActionTypes . CREATE_ERROR ; constructor ( public payload ) { } } export class UpdateAction implements Action { type = ActionTypes . UPDATE ; constructor ( public payload ) { } } export class UpdateCompletedAction implements Action { type = ActionTypes . UPDATE_COMPLETED ; constructor ( public payload ) { } } export class UpdateErrorAction implements Action { type = ActionTypes . UPDATE_ERROR ; constructor ( public payload ) { } } export class RemoveAction implements Action { type = ActionTypes . REMOVE ; constructor ( public payload ) { } } export class RemoveCompletedAction implements Action { type = ActionTypes . REMOVE_COMPLETED ; constructor ( public payload ) { } } export class RemoveErrorAction implements Action { type = ActionTypes . REMOVE_ERROR ; constructor ( public payload ) { } } export type TaskAction = LoadAction | LoadCompletedAction | LoadErrorAction | CreateAction | CreateCompletedAction | CreateErrorAction | UpdateAction | UpdateCompletedAction | UpdateErrorAction | RemoveAction | RemoveCompletedAction | RemoveErrorAction ;