import { WebData } from '../../../ReduxCore/Util/webData';
import { Article } from '../../../Evolve/Entities/Article';
import { ArticleFormState, createArticleFormState } from '../../../Evolve/Forms/ArticleForm';

export interface ArticleListState {
    webData: WebData<Article[]>;
    createFormOpen: boolean;
    createForm: ArticleFormState;
    createFormSaving: boolean;
    editFormOpen: boolean;
    editForm: ArticleFormState;
    editFormSaving: boolean;
    editing: null | number;
    deleting: null | number;

}

export function initArticleListState(): ArticleListState {
    return {
        webData: {type: 'Loading'},
        createFormOpen: false,
        createForm: createArticleFormState(),
        createFormSaving: false,
        editFormOpen: false,
        editForm: createArticleFormState(),
        editFormSaving: false,
    };
}
        editing: null,
        deleting: null