import { HttpEvent } from '@angular/common/http'; import { Observable, Subscription } from 'rxjs'; export type UploadState = 'local' | 'uploading' | 'aborted' | 'uploaded' | 'validating' | 'error' | 'deleted' | 'done'; export type StateMap = { [key in UploadState]: string | string[]; }; export interface LocalFile { raw: File | undefined; progress: number; uploadState: UploadState; uploadRequests: Subscription | undefined; } export interface APIStatusReason { originatorId: string; reason: string; additionalInformation?: string; } export interface APIStatusBaseProperties { internalStatusReasonCode: string | null; statusReasonInformation: APIStatusReason[] | null; } export type APIStatus = T & { id: string; status: string; }; export interface APIFileBaseProperties { principal: string; uploadDate: string; registrarId: string; registrarName: string; } export type APIFile = APIStatus & T & { id: string; fileName: string; }; export interface EventStateChange extends Partial { uploadState: UploadState; fileName: string; } export interface FileService { uploadFile(file: File): Observable>>; fetchFiles(statuses?: string[]): Observable>>; fetchStatus(id: string): Observable | undefined>; /** Uses file as param to fetch file status. */ fetchStatusFor?(file: APIFile): Observable | undefined>; removeFile(id: string): Observable; /** Uses file as param to remove file. */ removeFileFor?(file: APIFile): Observable; }