import {createActionGroup, emptyProps, props} from "@ngrx/store";
import {Account, List} from "projects/mastodon-api/src/public-api";

export const fromMastodonApi = createActionGroup({
    source: 'MastodonApi',
    events: {
        'Lists Loaded Success': props<{ lists: ReadonlyArray<List> }>(),
        'Lists Loaded Error': emptyProps(),

        'Account Ids for Lists Loaded Success': props<{ mappings: { [listId: string]: string[] } }>(),

        'Followings Loaded Success': props<{ followings: ReadonlyArray<Account> }>(),
        'Followings Loaded Error': props<{ error: string }>(),

        'Add Account to List Success': emptyProps(),
        'Add Account to List Error': emptyProps(),

        'Remove Account from List Success': emptyProps(),
        'Remove Account from List Error': emptyProps(),

        'Create List Success': props<{ listId: string, title: string }>(),
        'Create List Error': emptyProps(),

        'Update List Success': props<{ listId: string, newTitle: string }>(),
        'Update List Error': emptyProps(),
    }
});
