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 3.78 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';
import { Course } from '@app/core/models/course';

export enum PlanActionTypes {
  InitialPlanLoadResponse = '[Plan] Initial Load Response',

  ChangeVisiblePlanRequest = '[Plan] Change Visible Request',
  ChangeVisiblePlanResponse = '[Plan] Change Visible Response',

  AddCourseRequest = '[Plan] Add Course Request',
  AddCourseResponse = '[Plan] Add Course Response',

  RemoveCourseRequest = '[Plan] Remove Course Request',
  RemoveCourseResponse = '[Plan] Remove Course Response',

  ChangeCourseTermRequest = '[Plan] Change Course Term Request',
  ChangeCourseTermResponse = '[Plan] Change Course Term Response',

  AddSavedForLaterReqeust = '[Plan] Add Saved For Later Request',
  AddSavedForLaterResponse = '[Plan] Add Saved For Later Response',

  RemoveSavedForLaterReqeust = '[Plan] Remove Saved For Later Request',
  RemoveSavedForLaterResponse = '[Plan] Remove Saved For Later Response',

  MoveFromSavedToTermRequest = '[Plan] Move Course From Saved to Term Request',
  MoveFromSavedToTermResponse = '[Plan] Move Course From Saved to Term Response',
}

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

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

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

export class ChangeCourseTermRequest implements Action {
  public readonly type = PlanActionTypes.ChangeCourseTermRequest;
  constructor(public payload: { to: string; from: string; id: number }) {}
}

export class ChangeCourseTermResponse implements Action {
  public readonly type = PlanActionTypes.ChangeCourseTermResponse;
  constructor(public payload: { to: string; from: string; id: number }) {}
}

export class AddCourseRequest implements Action {
  public readonly type = PlanActionTypes.AddCourseRequest;
  constructor(
    public payload: { subjectCode: string; courseId: string; termCode: string },
  ) {}
}

export class AddCourseResponse implements Action {
  public readonly type = PlanActionTypes.AddCourseResponse;
  constructor(public payload: { course: Course }) {}
}

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

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

export class AddSavedForLaterRequest implements Action {
  public readonly type = PlanActionTypes.AddSavedForLaterReqeust;
  constructor(public payload: { subjectCode: string; courseId: string }) {}
}

export class AddSavedForLaterResponse implements Action {
  public readonly type = PlanActionTypes.AddSavedForLaterResponse;
  constructor(public payload: { subjectCode: string; courseId: string }) {}
}

export class RemoveSavedForLaterRequest implements Action {
  public readonly type = PlanActionTypes.RemoveSavedForLaterReqeust;
  constructor(public payload: { subjectCode: string; courseId: string }) {}
}

export class RemoveSavedForLaterResponse implements Action {
  public readonly type = PlanActionTypes.RemoveSavedForLaterResponse;
  constructor(public payload: { subjectCode: string; courseId: string }) {}
}