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.
state.ts 973 B
import { Alert } from './../../core/models/alert';
import { AuditMetadata } from '../models/audit-metadata';
import { DegreePlan } from '@app/core/models/degree-plan';
import { Audit } from '../models/audit/audit';

export type MetadataStatus =
  | { status: 'Error'; message: string }
  | { status: 'NotLoaded' }
  | { status: 'Loading' }
  | {
      status: 'Loaded';
      programMetadata: AuditMetadata[];
      whatIfMetadata: AuditMetadata[];
    };

export type AuditStatus =
  | { status: 'Error'; message: string }
  | { status: 'NotLoaded' }
  | { status: 'Loading'; metadata: AuditMetadata }
  | { status: 'Loaded'; metadata: AuditMetadata; audit: Audit };

export interface DARSState {
  degreePlans: DegreePlan[];
  metadata: MetadataStatus;
  audits: { [darsDegreeAuditReportId: number]: AuditStatus };
  alerts: Alert[];
}

export const INITIAL_DARS_STATE: DARSState = {
  degreePlans: [],
  metadata: { status: 'NotLoaded' },
  audits: {},
  alerts: [],
};