import {
  ScriptingObjectNames
} from "@elliemae/pui-scripting-object";
import { ScriptingObject, Event } from "@elliemae/microfe-common";
class AppraisalService extends ScriptingObject {
  #loanId;
  #creditScore;
  Close = new Event({
    name: "Close",
    objectId: ScriptingObjectNames.Module
  });
  Unloading = new Event({
    name: "Unloading",
    objectId: ScriptingObjectNames.Module
  });
  onPreCommit = new Event({
    name: "onPreCommit",
    objectId: ScriptingObjectNames.Module
  });
  onSaved = new Event({
    name: "onSaved",
    objectId: ScriptingObjectNames.Module
  });
  constructor({
    loanId,
    creditScore
  }) {
    super(ScriptingObjectNames.Module);
    this.#loanId = loanId;
    this.#creditScore = creditScore;
  }
  getCapabilities = () => Promise.resolve({
    isAdmin: true,
    los: "Encompass"
  });
  getParameters = () => Promise.resolve({
    moduleId: "appraisalService",
    loanId: this.#loanId,
    creditScore: this.#creditScore
  });
  setCreditScore = (creditScore) => {
    this.#creditScore = creditScore;
    return Promise.resolve();
  };
  saveLoan = () => Promise.resolve();
  commit = () => new Promise((resolve) => {
    setTimeout(() => {
      resolve({ loanId: this.#loanId });
    }, 1e3);
  });
  delete = () => {
    throw new Error("Not implemented");
  };
  log = async (message, level) => {
    console.log(message, level);
    return Promise.resolve();
  };
  unload = async () => {
  };
}
export {
  AppraisalService
};
