import { of } from "rxjs";
import { AttachmentDownloadUrl, AttachmentPreview, AttachmentService, AttachmentUpload } from "../../../AttachmentService";

interface MockAttachmentServiceInterface {
  downloadUrl: AttachmentDownloadUrl;
  preview: AttachmentPreview;
  upload: AttachmentUpload;
}

export class MockAttachmentService implements AttachmentService {
  constructor(private readonly state: MockAttachmentServiceInterface) {}
  public getDownloadUrl() {
    return of<AttachmentDownloadUrl>(this.state.downloadUrl);
  }
  public getPreview() {
    return of<AttachmentPreview>(this.state.preview);
  }
  public getUploadState() {
    return of<AttachmentUpload>(this.state.upload);
  }
  public seedPreview() {}
  public upload(): Promise<{ id: string }> {
    throw new Error();
  }
}
