import type { createDatabase } from "@prodobit/database"; import type { CreateCalibrationPlanRequest, UpdateCalibrationPlanRequest, CalibrationPlanQuery, CreateCalibrationRecordRequest, UpdateCalibrationRecordRequest, CalibrationRecordQuery } from "@prodobit/types"; export declare class CalibrationService { private db; constructor(db: ReturnType); /** * Get all calibration plans for a tenant with optional filters */ getCalibrationPlans(tenantId: string, query?: CalibrationPlanQuery): Promise<{ id: string; tenantId: string; assetId: string; name: string; description: string | null; type: string; frequency: string; status: string; startDate: Date; endDate: Date | null; nextCalibrationDate: Date | null; lastCalibrationDate: Date | null; intervalDays: number | null; intervalMonths: number | null; calibrationStandard: string | null; referenceStandard: string | null; acceptanceCriteria: string | null; toleranceRange: string | null; estimatedDurationHours: number | null; defaultAssigneeId: string | null; externalProviderId: string | null; calibrationLocation: string | null; priority: string | null; instructions: string | null; checklistItems: unknown; requiredEquipment: string[] | null; environmentalConditions: string | null; requiresCertificate: boolean | null; certificateValidityDays: number | null; regulatoryRequirements: string[] | null; complianceStandards: string[] | null; autoCreateTask: boolean | null; taskCreationLeadDays: number | null; alertBeforeDays: number | null; alertRecipients: string[] | null; totalCalibrationCount: number | null; passedCalibrationCount: number | null; failedCalibrationCount: number | null; averageCompletionTime: string | null; imageIds: string[] | null; documentIds: string[] | null; procedureDocumentId: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }[]>; /** * Get a single calibration plan by ID */ getCalibrationPlanById(id: string, tenantId: string): Promise<{ id: string; tenantId: string; assetId: string; name: string; description: string | null; type: string; frequency: string; status: string; startDate: Date; endDate: Date | null; nextCalibrationDate: Date | null; lastCalibrationDate: Date | null; intervalDays: number | null; intervalMonths: number | null; calibrationStandard: string | null; referenceStandard: string | null; acceptanceCriteria: string | null; toleranceRange: string | null; estimatedDurationHours: number | null; defaultAssigneeId: string | null; externalProviderId: string | null; calibrationLocation: string | null; priority: string | null; instructions: string | null; checklistItems: unknown; requiredEquipment: string[] | null; environmentalConditions: string | null; requiresCertificate: boolean | null; certificateValidityDays: number | null; regulatoryRequirements: string[] | null; complianceStandards: string[] | null; autoCreateTask: boolean | null; taskCreationLeadDays: number | null; alertBeforeDays: number | null; alertRecipients: string[] | null; totalCalibrationCount: number | null; passedCalibrationCount: number | null; failedCalibrationCount: number | null; averageCompletionTime: string | null; imageIds: string[] | null; documentIds: string[] | null; procedureDocumentId: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }>; /** * Get calibration plans by asset ID */ getCalibrationPlansByAsset(assetId: string, tenantId: string): Promise<{ id: string; tenantId: string; assetId: string; name: string; description: string | null; type: string; frequency: string; status: string; startDate: Date; endDate: Date | null; nextCalibrationDate: Date | null; lastCalibrationDate: Date | null; intervalDays: number | null; intervalMonths: number | null; calibrationStandard: string | null; referenceStandard: string | null; acceptanceCriteria: string | null; toleranceRange: string | null; estimatedDurationHours: number | null; defaultAssigneeId: string | null; externalProviderId: string | null; calibrationLocation: string | null; priority: string | null; instructions: string | null; checklistItems: unknown; requiredEquipment: string[] | null; environmentalConditions: string | null; requiresCertificate: boolean | null; certificateValidityDays: number | null; regulatoryRequirements: string[] | null; complianceStandards: string[] | null; autoCreateTask: boolean | null; taskCreationLeadDays: number | null; alertBeforeDays: number | null; alertRecipients: string[] | null; totalCalibrationCount: number | null; passedCalibrationCount: number | null; failedCalibrationCount: number | null; averageCompletionTime: string | null; imageIds: string[] | null; documentIds: string[] | null; procedureDocumentId: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }[]>; /** * Create a new calibration plan */ createCalibrationPlan(data: CreateCalibrationPlanRequest, tenantId: string): Promise<{ id: string; name: string; description: string | null; status: string; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; tenantId: string; startDate: Date; endDate: Date | null; assetId: string; priority: string | null; imageIds: string[] | null; documentIds: string[] | null; type: string; checklistItems: unknown; frequency: string; intervalDays: number | null; estimatedDurationHours: number | null; defaultAssigneeId: string | null; instructions: string | null; autoCreateTask: boolean | null; taskCreationLeadDays: number | null; averageCompletionTime: string | null; procedureDocumentId: string | null; nextCalibrationDate: Date | null; lastCalibrationDate: Date | null; intervalMonths: number | null; calibrationStandard: string | null; referenceStandard: string | null; acceptanceCriteria: string | null; toleranceRange: string | null; externalProviderId: string | null; calibrationLocation: string | null; requiredEquipment: string[] | null; environmentalConditions: string | null; requiresCertificate: boolean | null; certificateValidityDays: number | null; regulatoryRequirements: string[] | null; complianceStandards: string[] | null; alertBeforeDays: number | null; alertRecipients: string[] | null; totalCalibrationCount: number | null; passedCalibrationCount: number | null; failedCalibrationCount: number | null; }>; /** * Update a calibration plan */ updateCalibrationPlan(id: string, tenantId: string, data: UpdateCalibrationPlanRequest): Promise<{ id: string; tenantId: string; assetId: string; name: string; description: string | null; type: string; frequency: string; status: string; startDate: Date; endDate: Date | null; nextCalibrationDate: Date | null; lastCalibrationDate: Date | null; intervalDays: number | null; intervalMonths: number | null; calibrationStandard: string | null; referenceStandard: string | null; acceptanceCriteria: string | null; toleranceRange: string | null; estimatedDurationHours: number | null; defaultAssigneeId: string | null; externalProviderId: string | null; calibrationLocation: string | null; priority: string | null; instructions: string | null; checklistItems: unknown; requiredEquipment: string[] | null; environmentalConditions: string | null; requiresCertificate: boolean | null; certificateValidityDays: number | null; regulatoryRequirements: string[] | null; complianceStandards: string[] | null; autoCreateTask: boolean | null; taskCreationLeadDays: number | null; alertBeforeDays: number | null; alertRecipients: string[] | null; totalCalibrationCount: number | null; passedCalibrationCount: number | null; failedCalibrationCount: number | null; averageCompletionTime: string | null; imageIds: string[] | null; documentIds: string[] | null; procedureDocumentId: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }>; /** * Delete (soft delete) a calibration plan */ deleteCalibrationPlan(id: string, tenantId: string): Promise<{ id: string; tenantId: string; assetId: string; name: string; description: string | null; type: string; frequency: string; status: string; startDate: Date; endDate: Date | null; nextCalibrationDate: Date | null; lastCalibrationDate: Date | null; intervalDays: number | null; intervalMonths: number | null; calibrationStandard: string | null; referenceStandard: string | null; acceptanceCriteria: string | null; toleranceRange: string | null; estimatedDurationHours: number | null; defaultAssigneeId: string | null; externalProviderId: string | null; calibrationLocation: string | null; priority: string | null; instructions: string | null; checklistItems: unknown; requiredEquipment: string[] | null; environmentalConditions: string | null; requiresCertificate: boolean | null; certificateValidityDays: number | null; regulatoryRequirements: string[] | null; complianceStandards: string[] | null; autoCreateTask: boolean | null; taskCreationLeadDays: number | null; alertBeforeDays: number | null; alertRecipients: string[] | null; totalCalibrationCount: number | null; passedCalibrationCount: number | null; failedCalibrationCount: number | null; averageCompletionTime: string | null; imageIds: string[] | null; documentIds: string[] | null; procedureDocumentId: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }>; /** * Get upcoming calibrations (next 60 days by default) */ getUpcomingCalibrations(tenantId: string, days?: number): Promise<{ id: string; tenantId: string; assetId: string; name: string; description: string | null; type: string; frequency: string; status: string; startDate: Date; endDate: Date | null; nextCalibrationDate: Date | null; lastCalibrationDate: Date | null; intervalDays: number | null; intervalMonths: number | null; calibrationStandard: string | null; referenceStandard: string | null; acceptanceCriteria: string | null; toleranceRange: string | null; estimatedDurationHours: number | null; defaultAssigneeId: string | null; externalProviderId: string | null; calibrationLocation: string | null; priority: string | null; instructions: string | null; checklistItems: unknown; requiredEquipment: string[] | null; environmentalConditions: string | null; requiresCertificate: boolean | null; certificateValidityDays: number | null; regulatoryRequirements: string[] | null; complianceStandards: string[] | null; autoCreateTask: boolean | null; taskCreationLeadDays: number | null; alertBeforeDays: number | null; alertRecipients: string[] | null; totalCalibrationCount: number | null; passedCalibrationCount: number | null; failedCalibrationCount: number | null; averageCompletionTime: string | null; imageIds: string[] | null; documentIds: string[] | null; procedureDocumentId: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }[]>; /** * Get calibrations with expiring certificates */ getExpiringCertificates(tenantId: string, days?: number): Promise<{ id: string; tenantId: string; calibrationPlanId: string; assetId: string; taskId: string | null; scheduledDate: Date; completedDate: Date | null; performedBy: string | null; externalProviderId: string | null; type: string; status: string; durationHours: number | null; calibrationResult: string | null; beforeCalibrationValues: unknown; afterCalibrationValues: unknown; deviationValues: unknown; adjustmentsMade: string | null; notes: string | null; failureReason: string | null; certificateNumber: string | null; certificateIssueDate: Date | null; certificateExpiryDate: Date | null; certificateDocumentId: string | null; accreditationBody: string | null; nextRecommendedDate: Date | null; recommendedActions: string | null; cost: string | null; currency: string | null; imageIds: string[] | null; documentIds: string[] | null; insertedAt: Date; updatedAt: Date; }[]>; /** * Get overdue calibrations */ getOverdueCalibrations(tenantId: string): Promise<{ id: string; tenantId: string; assetId: string; name: string; description: string | null; type: string; frequency: string; status: string; startDate: Date; endDate: Date | null; nextCalibrationDate: Date | null; lastCalibrationDate: Date | null; intervalDays: number | null; intervalMonths: number | null; calibrationStandard: string | null; referenceStandard: string | null; acceptanceCriteria: string | null; toleranceRange: string | null; estimatedDurationHours: number | null; defaultAssigneeId: string | null; externalProviderId: string | null; calibrationLocation: string | null; priority: string | null; instructions: string | null; checklistItems: unknown; requiredEquipment: string[] | null; environmentalConditions: string | null; requiresCertificate: boolean | null; certificateValidityDays: number | null; regulatoryRequirements: string[] | null; complianceStandards: string[] | null; autoCreateTask: boolean | null; taskCreationLeadDays: number | null; alertBeforeDays: number | null; alertRecipients: string[] | null; totalCalibrationCount: number | null; passedCalibrationCount: number | null; failedCalibrationCount: number | null; averageCompletionTime: string | null; imageIds: string[] | null; documentIds: string[] | null; procedureDocumentId: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }[]>; /** * Get all calibration records for a tenant with optional filters */ getCalibrationRecords(tenantId: string, query?: CalibrationRecordQuery): Promise<{ id: string; tenantId: string; calibrationPlanId: string; assetId: string; taskId: string | null; scheduledDate: Date; completedDate: Date | null; performedBy: string | null; externalProviderId: string | null; type: string; status: string; durationHours: number | null; calibrationResult: string | null; beforeCalibrationValues: unknown; afterCalibrationValues: unknown; deviationValues: unknown; adjustmentsMade: string | null; notes: string | null; failureReason: string | null; certificateNumber: string | null; certificateIssueDate: Date | null; certificateExpiryDate: Date | null; certificateDocumentId: string | null; accreditationBody: string | null; nextRecommendedDate: Date | null; recommendedActions: string | null; cost: string | null; currency: string | null; imageIds: string[] | null; documentIds: string[] | null; insertedAt: Date; updatedAt: Date; }[]>; /** * Get a single calibration record by ID */ getCalibrationRecordById(id: string, tenantId: string): Promise<{ id: string; tenantId: string; calibrationPlanId: string; assetId: string; taskId: string | null; scheduledDate: Date; completedDate: Date | null; performedBy: string | null; externalProviderId: string | null; type: string; status: string; durationHours: number | null; calibrationResult: string | null; beforeCalibrationValues: unknown; afterCalibrationValues: unknown; deviationValues: unknown; adjustmentsMade: string | null; notes: string | null; failureReason: string | null; certificateNumber: string | null; certificateIssueDate: Date | null; certificateExpiryDate: Date | null; certificateDocumentId: string | null; accreditationBody: string | null; nextRecommendedDate: Date | null; recommendedActions: string | null; cost: string | null; currency: string | null; imageIds: string[] | null; documentIds: string[] | null; insertedAt: Date; updatedAt: Date; }>; /** * Get calibration records by plan ID */ getCalibrationRecordsByPlan(planId: string, tenantId: string): Promise<{ id: string; tenantId: string; calibrationPlanId: string; assetId: string; taskId: string | null; scheduledDate: Date; completedDate: Date | null; performedBy: string | null; externalProviderId: string | null; type: string; status: string; durationHours: number | null; calibrationResult: string | null; beforeCalibrationValues: unknown; afterCalibrationValues: unknown; deviationValues: unknown; adjustmentsMade: string | null; notes: string | null; failureReason: string | null; certificateNumber: string | null; certificateIssueDate: Date | null; certificateExpiryDate: Date | null; certificateDocumentId: string | null; accreditationBody: string | null; nextRecommendedDate: Date | null; recommendedActions: string | null; cost: string | null; currency: string | null; imageIds: string[] | null; documentIds: string[] | null; insertedAt: Date; updatedAt: Date; }[]>; /** * Get calibration records by asset ID */ getCalibrationRecordsByAsset(assetId: string, tenantId: string): Promise<{ id: string; tenantId: string; calibrationPlanId: string; assetId: string; taskId: string | null; scheduledDate: Date; completedDate: Date | null; performedBy: string | null; externalProviderId: string | null; type: string; status: string; durationHours: number | null; calibrationResult: string | null; beforeCalibrationValues: unknown; afterCalibrationValues: unknown; deviationValues: unknown; adjustmentsMade: string | null; notes: string | null; failureReason: string | null; certificateNumber: string | null; certificateIssueDate: Date | null; certificateExpiryDate: Date | null; certificateDocumentId: string | null; accreditationBody: string | null; nextRecommendedDate: Date | null; recommendedActions: string | null; cost: string | null; currency: string | null; imageIds: string[] | null; documentIds: string[] | null; insertedAt: Date; updatedAt: Date; }[]>; /** * Create a new calibration record */ createCalibrationRecord(data: CreateCalibrationRecordRequest, tenantId: string, assetId: string): Promise<{ id: string; status: string; insertedAt: Date; updatedAt: Date; tenantId: string; assetId: string; cost: string | null; currency: string | null; notes: string | null; imageIds: string[] | null; documentIds: string[] | null; type: string; taskId: string | null; scheduledDate: Date; completedDate: Date | null; performedBy: string | null; durationHours: number | null; nextRecommendedDate: Date | null; externalProviderId: string | null; calibrationPlanId: string; calibrationResult: string | null; beforeCalibrationValues: unknown; afterCalibrationValues: unknown; deviationValues: unknown; adjustmentsMade: string | null; failureReason: string | null; certificateNumber: string | null; certificateIssueDate: Date | null; certificateExpiryDate: Date | null; certificateDocumentId: string | null; accreditationBody: string | null; recommendedActions: string | null; }>; /** * Update a calibration record */ updateCalibrationRecord(id: string, tenantId: string, data: UpdateCalibrationRecordRequest): Promise<{ id: string; tenantId: string; calibrationPlanId: string; assetId: string; taskId: string | null; scheduledDate: Date; completedDate: Date | null; performedBy: string | null; externalProviderId: string | null; type: string; status: string; durationHours: number | null; calibrationResult: string | null; beforeCalibrationValues: unknown; afterCalibrationValues: unknown; deviationValues: unknown; adjustmentsMade: string | null; notes: string | null; failureReason: string | null; certificateNumber: string | null; certificateIssueDate: Date | null; certificateExpiryDate: Date | null; certificateDocumentId: string | null; accreditationBody: string | null; nextRecommendedDate: Date | null; recommendedActions: string | null; cost: string | null; currency: string | null; imageIds: string[] | null; documentIds: string[] | null; insertedAt: Date; updatedAt: Date; }>; /** * Delete a calibration record */ deleteCalibrationRecord(id: string, tenantId: string): Promise<{ id: string; status: string; insertedAt: Date; updatedAt: Date; tenantId: string; assetId: string; cost: string | null; currency: string | null; notes: string | null; imageIds: string[] | null; documentIds: string[] | null; type: string; taskId: string | null; scheduledDate: Date; completedDate: Date | null; performedBy: string | null; durationHours: number | null; nextRecommendedDate: Date | null; externalProviderId: string | null; calibrationPlanId: string; calibrationResult: string | null; beforeCalibrationValues: unknown; afterCalibrationValues: unknown; deviationValues: unknown; adjustmentsMade: string | null; failureReason: string | null; certificateNumber: string | null; certificateIssueDate: Date | null; certificateExpiryDate: Date | null; certificateDocumentId: string | null; accreditationBody: string | null; recommendedActions: string | null; }>; /** * Update calibration plan metrics after completion */ private updateCalibrationPlanAfterCompletion; /** * Calculate next calibration date based on frequency */ private calculateNextCalibrationDate; } //# sourceMappingURL=service.d.ts.map