import { createActionGroup, emptyProps, props } from '@ngrx/store';
import { Setting } from '../../models/setting.model';

export const SettingsActions = createActionGroup({
  source: 'Settings',
  events: {
    'Load Settings': props<{ module?: string; forceReload?: boolean }>(),
    'Load Settings Success': props<{ settings: Setting[] }>(),
    'Load Settings Failure': props<{ error: string }>(),
    'Upsert Setting': props<{ setting: any }>(),
    'Upsert Setting Success': props<{ setting: Setting }>(),
    'Upsert Setting Failure': props<{ error: string }>(),
    'Delete Setting': props<{ id: number }>(),
    'Delete Setting Success': props<{ id: number }>(),
    'Delete Setting Failure': props<{ error: string }>(),
    'Clear Settings Error': emptyProps(),
  },
});
