import { ChartDataPoint } from './../model/ChartDataPoint.model';
import { PrivateCharts } from './../model/PrivateCharts.model';
import { Action } from "@ngrx/store";
import { Chart } from '../model/Chart.model';

export const SET_PRIVATE_CHARTS = 'SET_PRIVATE_CHARTS';
export const SET_PUBLIC_CHARTS = 'SET_PUBLIC_CHARTS';

export const PUT_USER_CHART = 'PUT_USER_CHART';

export const ADD_ADDED_CHART = 'ADD_ADDED_CHART';
export const REMOVE_ADDED_CHART = 'REMOVE_ADDED_CHART';

export const REMOVE_CHART = 'REMOVE_CHART';

export const ADD_CHART_DATA = 'ADD_CHART_DATA';

export class SetPrivateChartsAction implements Action{
    readonly type = SET_PRIVATE_CHARTS;
    constructor(public privateCharts: PrivateCharts) {}
}

export class SetPublicChartsAction implements Action{
    readonly type = SET_PUBLIC_CHARTS;
    constructor(public publicCharts: Chart[]) {}
}

export class PutUserChartAction implements Action{
    readonly type = PUT_USER_CHART;
    constructor(public chart: Chart) {}
}

export class RemoveAddedChart implements Action{
    readonly type = REMOVE_ADDED_CHART;
    constructor(public chartId: number) {}
}

export class AddAddedChart implements Action{
    readonly type = ADD_ADDED_CHART;
    constructor(public chart: Chart) {}
}

export class RemoveChartAction implements Action{
    readonly type = REMOVE_CHART;
    constructor(public chartId: number) {}
}

export class AddChartDataAction implements Action{
    readonly type = ADD_CHART_DATA;
    constructor(public chartId: number, public chartData: ChartDataPoint[]) {}
}

export type ChartsActions = 
    SetPrivateChartsAction | 
    SetPublicChartsAction | 
    PutUserChartAction |
    RemoveAddedChart |
    AddAddedChart |
    RemoveChartAction |
    AddChartDataAction;