import { Action } from "@ngrx/store";
import { New } from "../model/New.model";

export const SET_NEWS = 'SET_NEWS';
export const ADD_NEWS = 'ADD_NEWS';
export const REMOVE_NEW = 'REMOVE_NEW';
export const SAVE_NEW = 'SAVE_NEW';

export class SetNewsAction implements Action{
    readonly type = SET_NEWS;
    constructor(public news: New[]){ }
}
export class AddNewsAction implements Action{
    readonly type = ADD_NEWS;
    constructor(public news: New[]){ }
}

export class RemoveNewAction implements Action {
    readonly type = REMOVE_NEW;
    constructor(public id: number){ }
}

export class SaveNewAction implements Action {
    readonly type = SAVE_NEW;
    constructor(public newItem: New){ }
}


export type NewsActions = SetNewsAction | AddNewsAction | RemoveNewAction | SaveNewAction;