import { inject } from '@angular/core';
import dayjs from 'dayjs';
import { BasicDataService } from '../services/basic.service';
import { KnowledgeService } from '../services/knowledge.service';

export class RiskItemModel {
  readonly basic = inject(BasicDataService);
  readonly knowledge = inject(KnowledgeService);

  getUpdateTime(item: Knowledge.RiskItem) {
    if (!item.updatedDate) return '';
    return dayjs(item.updatedDate).format('YYYY-MM-DD HH:mm');
  }
  getTypeName(typeId: number) {
    return this.knowledge.getTypeName(typeId);
  }
  getCategoryName(categoryId: number, typeId: number) {
    return this.knowledge.getCategoryName(categoryId, typeId);
  }
  getOperationName(operationId: number) {
    return this.basic.getOperationName(operationId);
  }

  getPositionName(positionId: number) {
    return this.basic.getPositionName(positionId);
  }
  getEquipmentName(equipmentId: number) {
    return this.basic.getEquipmentName(equipmentId);
  }
  getJobName(jobId: number) {
    return this.basic.getJobName(jobId);
  }
  getConsequenceName(consequenceId: number) {
    return this.basic.getConsequenceName(consequenceId);
  }
  getDocName(docId: number) {
    return this.knowledge.getDocName(docId);
  }
  getDocDto(docId: number) {
    return this.knowledge.getDocDto(docId);
  }
}
