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

export const fromAuthorize = createActionGroup({
    source: 'Authorize',
    events: {
        'Load Local Storage': emptyProps(),
        'Register Application': props<{ instanceName: string, redirectUrl: string }>(),
        'Register Application Success': props<{ id: string, appName: string, website: string, clientId: string, clientSecret: string }>(),
        'Register Application Error': props<{ error: any }>(),
        'Authorize User': props<{ instanceName: string, clientId: string, redirectUrl: string }>(),
        'Get Access Token': props<{ code: string, instanceName: string, clientId: string, clientSecret: string, redirectUrl: string }>(),
        'Get Access Token Success': props<{ accessToken: string, account: Account }>(),
        'Get Access Token Error': emptyProps(),
        'Logout': emptyProps(),
    }
});
