Skip to content
Snippets Groups Projects
Forked from an inaccessible project.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
plan.actions.ts 1.71 KiB
import { Action } from '@ngrx/store';
import { DegreePlan } from '@app/core/models/degree-plan';
import { PlannedTerm } from '@app/core/models/planned-term';
import { DegreePlannerState } from '@app/degree-planner/store/state';

export enum PlanActionTypes {
  InitialLoadSuccess = '[Plan] Initial Load (Success)',

  SwitchPlan = '[Plan] Switch',
  SwitchPlanSuccess = '[Plan] Switch (Success)',

  PlanError = '[Plan] Error',

  MakePlanPrimary = '[Plan] Make Plan Primary',
  MakePlanPrimarySuccess = '[Plan] Make Plan Primary Success',
  MakePlanPrimaryFailure = '[Plan] Make Plan Primary Failure',
}

export class InitialLoadSuccess implements Action {
  public readonly type = PlanActionTypes.InitialLoadSuccess;
  constructor(public payload: DegreePlannerState) {}
}

export class SwitchPlan implements Action {
  public readonly type = PlanActionTypes.SwitchPlan;
  constructor(public payload: { newVisibleRoadmapId: number }) {}
}

export class SwitchPlanSuccess implements Action {
  public readonly type = PlanActionTypes.SwitchPlanSuccess;
  constructor(
    public payload: {
      visibleDegreePlan: DegreePlan;
      visibleTerms: PlannedTerm[];
    },
  ) {}
}

export class PlanError implements Action {
  public readonly type = PlanActionTypes.PlanError;
  constructor(public payload: { message: string; error: any }) {}
}

export class MakePlanPrimary implements Action {
  public readonly type = PlanActionTypes.MakePlanPrimary;
  constructor() {}
}

export class MakePlanPrimarySuccess implements Action {
  public readonly type = PlanActionTypes.MakePlanPrimarySuccess;
  constructor() {}
}

export class MakePlanPrimaryFailure implements Action {
  public readonly type = PlanActionTypes.MakePlanPrimaryFailure;
  constructor() {}
}