import type { Database } from "@prodobit/database"; /** * Service Contract Service * Handles CRUD operations for service contracts */ export declare class ServiceContractService { private db; constructor(db: Database); /** * Get all service contracts with optional filters */ getContracts(tenantId: string, query?: { customerId?: string; contractType?: string; status?: string; accountManagerId?: string; expiringWithinDays?: number; search?: string; }): Promise<{ id: string; tenantId: string; contractNumber: string; name: string; description: string | null; customerId: string; contractType: "preventive" | "maintenance" | "calibration" | "support" | "warranty_extension" | "full_service" | "on_demand"; billingModel: "fixed" | "per_incident" | "hourly" | "monthly" | "quarterly" | "annually" | "hybrid"; status: "active" | "draft" | "pending_approval" | "suspended" | "expired" | "cancelled" | "renewed"; startDate: Date; endDate: Date; autoRenew: boolean; renewalNoticeDays: number | null; contractValue: string | null; currency: string; monthlyFee: string | null; hourlyRate: string | null; incidentRate: string | null; includedIncidents: number | null; includedHours: string | null; includedPreventiveVisits: number | null; slaConfig: string | null; coverageScope: string | null; excludedItems: string | null; primaryContactId: string | null; technicalContactId: string | null; accountManagerId: string | null; serviceTeamId: string | null; documentIds: string | null; termsAndConditions: string | null; specialTerms: string | null; totalTicketsCreated: number; totalIncidentsUsed: number; totalHoursUsed: string; notes: string | null; metadata: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }[]>; /** * Get contract by ID */ getContractById(contractId: string, tenantId: string): Promise<{ id: string; tenantId: string; contractNumber: string; name: string; description: string | null; customerId: string; contractType: "preventive" | "maintenance" | "calibration" | "support" | "warranty_extension" | "full_service" | "on_demand"; billingModel: "fixed" | "per_incident" | "hourly" | "monthly" | "quarterly" | "annually" | "hybrid"; status: "active" | "draft" | "pending_approval" | "suspended" | "expired" | "cancelled" | "renewed"; startDate: Date; endDate: Date; autoRenew: boolean; renewalNoticeDays: number | null; contractValue: string | null; currency: string; monthlyFee: string | null; hourlyRate: string | null; incidentRate: string | null; includedIncidents: number | null; includedHours: string | null; includedPreventiveVisits: number | null; slaConfig: string | null; coverageScope: string | null; excludedItems: string | null; primaryContactId: string | null; technicalContactId: string | null; accountManagerId: string | null; serviceTeamId: string | null; documentIds: string | null; termsAndConditions: string | null; specialTerms: string | null; totalTicketsCreated: number; totalIncidentsUsed: number; totalHoursUsed: string; notes: string | null; metadata: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }>; /** * Get contracts by customer */ getContractsByCustomer(customerId: string, tenantId: string): Promise<{ id: string; tenantId: string; contractNumber: string; name: string; description: string | null; customerId: string; contractType: "preventive" | "maintenance" | "calibration" | "support" | "warranty_extension" | "full_service" | "on_demand"; billingModel: "fixed" | "per_incident" | "hourly" | "monthly" | "quarterly" | "annually" | "hybrid"; status: "active" | "draft" | "pending_approval" | "suspended" | "expired" | "cancelled" | "renewed"; startDate: Date; endDate: Date; autoRenew: boolean; renewalNoticeDays: number | null; contractValue: string | null; currency: string; monthlyFee: string | null; hourlyRate: string | null; incidentRate: string | null; includedIncidents: number | null; includedHours: string | null; includedPreventiveVisits: number | null; slaConfig: string | null; coverageScope: string | null; excludedItems: string | null; primaryContactId: string | null; technicalContactId: string | null; accountManagerId: string | null; serviceTeamId: string | null; documentIds: string | null; termsAndConditions: string | null; specialTerms: string | null; totalTicketsCreated: number; totalIncidentsUsed: number; totalHoursUsed: string; notes: string | null; metadata: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }[]>; /** * Get expiring contracts */ getExpiringContracts(tenantId: string, withinDays?: number): Promise<{ id: string; tenantId: string; contractNumber: string; name: string; description: string | null; customerId: string; contractType: "preventive" | "maintenance" | "calibration" | "support" | "warranty_extension" | "full_service" | "on_demand"; billingModel: "fixed" | "per_incident" | "hourly" | "monthly" | "quarterly" | "annually" | "hybrid"; status: "active" | "draft" | "pending_approval" | "suspended" | "expired" | "cancelled" | "renewed"; startDate: Date; endDate: Date; autoRenew: boolean; renewalNoticeDays: number | null; contractValue: string | null; currency: string; monthlyFee: string | null; hourlyRate: string | null; incidentRate: string | null; includedIncidents: number | null; includedHours: string | null; includedPreventiveVisits: number | null; slaConfig: string | null; coverageScope: string | null; excludedItems: string | null; primaryContactId: string | null; technicalContactId: string | null; accountManagerId: string | null; serviceTeamId: string | null; documentIds: string | null; termsAndConditions: string | null; specialTerms: string | null; totalTicketsCreated: number; totalIncidentsUsed: number; totalHoursUsed: string; notes: string | null; metadata: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }[]>; /** * Create new service contract */ createContract(data: { contractNumber: string; name: string; description?: string; customerId: string; contractType: string; billingModel: string; startDate: string; endDate: string; autoRenew?: boolean; renewalNoticeDays?: number; contractValue?: number; currency?: string; monthlyFee?: number; hourlyRate?: number; incidentRate?: number; includedIncidents?: number; includedHours?: number; includedPreventiveVisits?: number; slaConfig?: any; coverageScope?: any; excludedItems?: any; primaryContactId?: string; technicalContactId?: string; accountManagerId?: string; serviceTeamId?: string; documentIds?: string[]; termsAndConditions?: string; specialTerms?: string; notes?: string; assetIds?: string[]; }, tenantId: string): Promise<{ id: string; name: string; description: string | null; status: "active" | "draft" | "pending_approval" | "suspended" | "expired" | "cancelled" | "renewed"; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; tenantId: string; startDate: Date; endDate: Date; currency: string; contractNumber: string; notes: string | null; metadata: string | null; customerId: string; documentIds: string | null; contractType: "preventive" | "maintenance" | "calibration" | "support" | "warranty_extension" | "full_service" | "on_demand"; billingModel: "fixed" | "per_incident" | "hourly" | "monthly" | "quarterly" | "annually" | "hybrid"; autoRenew: boolean; renewalNoticeDays: number | null; contractValue: string | null; monthlyFee: string | null; hourlyRate: string | null; incidentRate: string | null; includedIncidents: number | null; includedHours: string | null; includedPreventiveVisits: number | null; slaConfig: string | null; coverageScope: string | null; excludedItems: string | null; primaryContactId: string | null; technicalContactId: string | null; accountManagerId: string | null; serviceTeamId: string | null; termsAndConditions: string | null; specialTerms: string | null; totalTicketsCreated: number; totalIncidentsUsed: number; totalHoursUsed: string; }>; /** * Update service contract */ updateContract(contractId: string, tenantId: string, data: Partial<{ name: string; description: string; contractType: string; billingModel: string; status: string; startDate: string; endDate: string; autoRenew: boolean; renewalNoticeDays: number; contractValue: number; currency: string; monthlyFee: number; hourlyRate: number; incidentRate: number; includedIncidents: number; includedHours: number; includedPreventiveVisits: number; slaConfig: any; coverageScope: any; excludedItems: any; primaryContactId: string; technicalContactId: string; accountManagerId: string; serviceTeamId: string; documentIds: string[]; termsAndConditions: string; specialTerms: string; notes: string; }>): Promise<{ id: string; tenantId: string; contractNumber: string; name: string; description: string | null; customerId: string; contractType: "preventive" | "maintenance" | "calibration" | "support" | "warranty_extension" | "full_service" | "on_demand"; billingModel: "fixed" | "per_incident" | "hourly" | "monthly" | "quarterly" | "annually" | "hybrid"; status: "active" | "draft" | "pending_approval" | "suspended" | "expired" | "cancelled" | "renewed"; startDate: Date; endDate: Date; autoRenew: boolean; renewalNoticeDays: number | null; contractValue: string | null; currency: string; monthlyFee: string | null; hourlyRate: string | null; incidentRate: string | null; includedIncidents: number | null; includedHours: string | null; includedPreventiveVisits: number | null; slaConfig: string | null; coverageScope: string | null; excludedItems: string | null; primaryContactId: string | null; technicalContactId: string | null; accountManagerId: string | null; serviceTeamId: string | null; documentIds: string | null; termsAndConditions: string | null; specialTerms: string | null; totalTicketsCreated: number; totalIncidentsUsed: number; totalHoursUsed: string; notes: string | null; metadata: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }>; /** * Delete service contract (soft delete) */ deleteContract(contractId: string, tenantId: string): Promise; /** * Get assets for a contract */ getContractAssets(contractId: string, tenantId: string): Promise<{ id: string; tenantId: string; contractId: string; assetId: string; coverageStartDate: Date | null; coverageEndDate: Date | null; specialTerms: string | null; isActive: boolean; insertedAt: Date; }[]>; /** * Add asset to contract */ addContractAsset(contractId: string, tenantId: string, data: { assetId: string; coverageStartDate?: string; coverageEndDate?: string; specialTerms?: string; }): Promise<{ id: string; insertedAt: Date; tenantId: string; isActive: boolean; assetId: string; specialTerms: string | null; contractId: string; coverageStartDate: Date | null; coverageEndDate: Date | null; }>; /** * Remove asset from contract */ removeContractAsset(contractAssetId: string, tenantId: string): Promise; /** * Get contracts for an asset */ getContractsForAsset(assetId: string, tenantId: string): Promise<{ contractAsset: { id: string; tenantId: string; contractId: string; assetId: string; coverageStartDate: Date | null; coverageEndDate: Date | null; specialTerms: string | null; isActive: boolean; insertedAt: Date; }; id: string; tenantId: string; contractNumber: string; name: string; description: string | null; customerId: string; contractType: "preventive" | "maintenance" | "calibration" | "support" | "warranty_extension" | "full_service" | "on_demand"; billingModel: "fixed" | "per_incident" | "hourly" | "monthly" | "quarterly" | "annually" | "hybrid"; status: "active" | "draft" | "pending_approval" | "suspended" | "expired" | "cancelled" | "renewed"; startDate: Date; endDate: Date; autoRenew: boolean; renewalNoticeDays: number | null; contractValue: string | null; currency: string; monthlyFee: string | null; hourlyRate: string | null; incidentRate: string | null; includedIncidents: number | null; includedHours: string | null; includedPreventiveVisits: number | null; slaConfig: string | null; coverageScope: string | null; excludedItems: string | null; primaryContactId: string | null; technicalContactId: string | null; accountManagerId: string | null; serviceTeamId: string | null; documentIds: string | null; termsAndConditions: string | null; specialTerms: string | null; totalTicketsCreated: number; totalIncidentsUsed: number; totalHoursUsed: string; notes: string | null; metadata: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }[]>; } /** * Service Ticket Service * Handles CRUD operations for service tickets */ export declare class ServiceTicketService { private db; constructor(db: Database); /** * Generate ticket number */ private generateTicketNumber; /** * Calculate SLA times based on priority and contract config */ private calculateSLATimes; /** * Get all service tickets with optional filters */ getTickets(tenantId: string, query?: { contractId?: string; customerId?: string; assetId?: string; ticketType?: string; priority?: string; status?: string; assignedToId?: string; assignedTeamId?: string; reportedAfter?: string; reportedBefore?: string; search?: string; }): Promise<{ id: string; tenantId: string; ticketNumber: string; contractId: string | null; isBillable: boolean; customerId: string; contactPersonId: string | null; assetId: string | null; ticketType: "preventive" | "inspection" | "incident" | "request" | "corrective" | "installation" | "training" | "consultation"; priority: "medium" | "critical" | "high" | "low"; status: "cancelled" | "open" | "assigned" | "in_progress" | "pending_customer" | "pending_parts" | "on_hold" | "resolved" | "closed"; source: "email" | "scheduled" | "customer_portal" | "phone" | "chat" | "field_technician" | "system_alert" | "internal"; subject: string; description: string | null; problemCategory: string | null; errorCode: string | null; serviceLocationId: string | null; serviceAddress: string | null; assignedToId: string | null; assignedTeamId: string | null; slaResponseDue: Date | null; slaResolutionDue: Date | null; firstResponseAt: Date | null; reportedAt: Date; acknowledgedAt: Date | null; scheduledAt: Date | null; startedAt: Date | null; resolvedAt: Date | null; closedAt: Date | null; resolutionSummary: string | null; resolutionCode: string | null; rootCause: string | null; preventiveAction: string | null; travelTimeMinutes: number | null; workTimeMinutes: number | null; totalTimeMinutes: number | null; laborCost: string | null; partsCost: string | null; travelCost: string | null; otherCost: string | null; totalCost: string | null; currency: string | null; partsUsed: string | null; maintenanceRecordId: string | null; calibrationRecordId: string | null; relatedTicketId: string | null; attachmentIds: string | null; signatureImageId: string | null; customerSatisfaction: number | null; customerFeedback: string | null; internalNotes: string | null; metadata: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }[]>; /** * Get ticket by ID */ getTicketById(ticketId: string, tenantId: string): Promise<{ id: string; tenantId: string; ticketNumber: string; contractId: string | null; isBillable: boolean; customerId: string; contactPersonId: string | null; assetId: string | null; ticketType: "preventive" | "inspection" | "incident" | "request" | "corrective" | "installation" | "training" | "consultation"; priority: "medium" | "critical" | "high" | "low"; status: "cancelled" | "open" | "assigned" | "in_progress" | "pending_customer" | "pending_parts" | "on_hold" | "resolved" | "closed"; source: "email" | "scheduled" | "customer_portal" | "phone" | "chat" | "field_technician" | "system_alert" | "internal"; subject: string; description: string | null; problemCategory: string | null; errorCode: string | null; serviceLocationId: string | null; serviceAddress: string | null; assignedToId: string | null; assignedTeamId: string | null; slaResponseDue: Date | null; slaResolutionDue: Date | null; firstResponseAt: Date | null; reportedAt: Date; acknowledgedAt: Date | null; scheduledAt: Date | null; startedAt: Date | null; resolvedAt: Date | null; closedAt: Date | null; resolutionSummary: string | null; resolutionCode: string | null; rootCause: string | null; preventiveAction: string | null; travelTimeMinutes: number | null; workTimeMinutes: number | null; totalTimeMinutes: number | null; laborCost: string | null; partsCost: string | null; travelCost: string | null; otherCost: string | null; totalCost: string | null; currency: string | null; partsUsed: string | null; maintenanceRecordId: string | null; calibrationRecordId: string | null; relatedTicketId: string | null; attachmentIds: string | null; signatureImageId: string | null; customerSatisfaction: number | null; customerFeedback: string | null; internalNotes: string | null; metadata: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }>; /** * Get tickets by contract */ getTicketsByContract(contractId: string, tenantId: string): Promise<{ id: string; tenantId: string; ticketNumber: string; contractId: string | null; isBillable: boolean; customerId: string; contactPersonId: string | null; assetId: string | null; ticketType: "preventive" | "inspection" | "incident" | "request" | "corrective" | "installation" | "training" | "consultation"; priority: "medium" | "critical" | "high" | "low"; status: "cancelled" | "open" | "assigned" | "in_progress" | "pending_customer" | "pending_parts" | "on_hold" | "resolved" | "closed"; source: "email" | "scheduled" | "customer_portal" | "phone" | "chat" | "field_technician" | "system_alert" | "internal"; subject: string; description: string | null; problemCategory: string | null; errorCode: string | null; serviceLocationId: string | null; serviceAddress: string | null; assignedToId: string | null; assignedTeamId: string | null; slaResponseDue: Date | null; slaResolutionDue: Date | null; firstResponseAt: Date | null; reportedAt: Date; acknowledgedAt: Date | null; scheduledAt: Date | null; startedAt: Date | null; resolvedAt: Date | null; closedAt: Date | null; resolutionSummary: string | null; resolutionCode: string | null; rootCause: string | null; preventiveAction: string | null; travelTimeMinutes: number | null; workTimeMinutes: number | null; totalTimeMinutes: number | null; laborCost: string | null; partsCost: string | null; travelCost: string | null; otherCost: string | null; totalCost: string | null; currency: string | null; partsUsed: string | null; maintenanceRecordId: string | null; calibrationRecordId: string | null; relatedTicketId: string | null; attachmentIds: string | null; signatureImageId: string | null; customerSatisfaction: number | null; customerFeedback: string | null; internalNotes: string | null; metadata: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }[]>; /** * Get tickets by asset */ getTicketsByAsset(assetId: string, tenantId: string): Promise<{ id: string; tenantId: string; ticketNumber: string; contractId: string | null; isBillable: boolean; customerId: string; contactPersonId: string | null; assetId: string | null; ticketType: "preventive" | "inspection" | "incident" | "request" | "corrective" | "installation" | "training" | "consultation"; priority: "medium" | "critical" | "high" | "low"; status: "cancelled" | "open" | "assigned" | "in_progress" | "pending_customer" | "pending_parts" | "on_hold" | "resolved" | "closed"; source: "email" | "scheduled" | "customer_portal" | "phone" | "chat" | "field_technician" | "system_alert" | "internal"; subject: string; description: string | null; problemCategory: string | null; errorCode: string | null; serviceLocationId: string | null; serviceAddress: string | null; assignedToId: string | null; assignedTeamId: string | null; slaResponseDue: Date | null; slaResolutionDue: Date | null; firstResponseAt: Date | null; reportedAt: Date; acknowledgedAt: Date | null; scheduledAt: Date | null; startedAt: Date | null; resolvedAt: Date | null; closedAt: Date | null; resolutionSummary: string | null; resolutionCode: string | null; rootCause: string | null; preventiveAction: string | null; travelTimeMinutes: number | null; workTimeMinutes: number | null; totalTimeMinutes: number | null; laborCost: string | null; partsCost: string | null; travelCost: string | null; otherCost: string | null; totalCost: string | null; currency: string | null; partsUsed: string | null; maintenanceRecordId: string | null; calibrationRecordId: string | null; relatedTicketId: string | null; attachmentIds: string | null; signatureImageId: string | null; customerSatisfaction: number | null; customerFeedback: string | null; internalNotes: string | null; metadata: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }[]>; /** * Get open tickets (not resolved or closed) */ getOpenTickets(tenantId: string): Promise<{ id: string; tenantId: string; ticketNumber: string; contractId: string | null; isBillable: boolean; customerId: string; contactPersonId: string | null; assetId: string | null; ticketType: "preventive" | "inspection" | "incident" | "request" | "corrective" | "installation" | "training" | "consultation"; priority: "medium" | "critical" | "high" | "low"; status: "cancelled" | "open" | "assigned" | "in_progress" | "pending_customer" | "pending_parts" | "on_hold" | "resolved" | "closed"; source: "email" | "scheduled" | "customer_portal" | "phone" | "chat" | "field_technician" | "system_alert" | "internal"; subject: string; description: string | null; problemCategory: string | null; errorCode: string | null; serviceLocationId: string | null; serviceAddress: string | null; assignedToId: string | null; assignedTeamId: string | null; slaResponseDue: Date | null; slaResolutionDue: Date | null; firstResponseAt: Date | null; reportedAt: Date; acknowledgedAt: Date | null; scheduledAt: Date | null; startedAt: Date | null; resolvedAt: Date | null; closedAt: Date | null; resolutionSummary: string | null; resolutionCode: string | null; rootCause: string | null; preventiveAction: string | null; travelTimeMinutes: number | null; workTimeMinutes: number | null; totalTimeMinutes: number | null; laborCost: string | null; partsCost: string | null; travelCost: string | null; otherCost: string | null; totalCost: string | null; currency: string | null; partsUsed: string | null; maintenanceRecordId: string | null; calibrationRecordId: string | null; relatedTicketId: string | null; attachmentIds: string | null; signatureImageId: string | null; customerSatisfaction: number | null; customerFeedback: string | null; internalNotes: string | null; metadata: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }[]>; /** * Get overdue tickets (past SLA) */ getOverdueTickets(tenantId: string): Promise<{ id: string; tenantId: string; ticketNumber: string; contractId: string | null; isBillable: boolean; customerId: string; contactPersonId: string | null; assetId: string | null; ticketType: "preventive" | "inspection" | "incident" | "request" | "corrective" | "installation" | "training" | "consultation"; priority: "medium" | "critical" | "high" | "low"; status: "cancelled" | "open" | "assigned" | "in_progress" | "pending_customer" | "pending_parts" | "on_hold" | "resolved" | "closed"; source: "email" | "scheduled" | "customer_portal" | "phone" | "chat" | "field_technician" | "system_alert" | "internal"; subject: string; description: string | null; problemCategory: string | null; errorCode: string | null; serviceLocationId: string | null; serviceAddress: string | null; assignedToId: string | null; assignedTeamId: string | null; slaResponseDue: Date | null; slaResolutionDue: Date | null; firstResponseAt: Date | null; reportedAt: Date; acknowledgedAt: Date | null; scheduledAt: Date | null; startedAt: Date | null; resolvedAt: Date | null; closedAt: Date | null; resolutionSummary: string | null; resolutionCode: string | null; rootCause: string | null; preventiveAction: string | null; travelTimeMinutes: number | null; workTimeMinutes: number | null; totalTimeMinutes: number | null; laborCost: string | null; partsCost: string | null; travelCost: string | null; otherCost: string | null; totalCost: string | null; currency: string | null; partsUsed: string | null; maintenanceRecordId: string | null; calibrationRecordId: string | null; relatedTicketId: string | null; attachmentIds: string | null; signatureImageId: string | null; customerSatisfaction: number | null; customerFeedback: string | null; internalNotes: string | null; metadata: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; }[]>; /** * Create new service ticket */ createTicket(data: { ticketNumber?: string; contractId?: string; isBillable?: boolean; customerId: string; contactPersonId?: string; assetId?: string; ticketType: string; priority: string; source?: string; subject: string; description?: string; problemCategory?: string; errorCode?: string; serviceLocationId?: string; serviceAddress?: string; assignedToId?: string; assignedTeamId?: string; scheduledAt?: string; internalNotes?: string; }, tenantId: string): Promise<{ id: string; description: string | null; status: "cancelled" | "open" | "assigned" | "in_progress" | "pending_customer" | "pending_parts" | "on_hold" | "resolved" | "closed"; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; tenantId: string; assetId: string | null; currency: string | null; signatureImageId: string | null; metadata: string | null; priority: "medium" | "critical" | "high" | "low"; customerId: string; reportedAt: Date; acknowledgedAt: Date | null; resolvedAt: Date | null; closedAt: Date | null; rootCause: string | null; assignedTeamId: string | null; source: "email" | "scheduled" | "customer_portal" | "phone" | "chat" | "field_technician" | "system_alert" | "internal"; maintenanceRecordId: string | null; calibrationRecordId: string | null; totalCost: string | null; contractId: string | null; ticketNumber: string; isBillable: boolean; contactPersonId: string | null; ticketType: "preventive" | "inspection" | "incident" | "request" | "corrective" | "installation" | "training" | "consultation"; subject: string; problemCategory: string | null; errorCode: string | null; serviceLocationId: string | null; serviceAddress: string | null; assignedToId: string | null; slaResponseDue: Date | null; slaResolutionDue: Date | null; firstResponseAt: Date | null; scheduledAt: Date | null; startedAt: Date | null; resolutionSummary: string | null; resolutionCode: string | null; preventiveAction: string | null; travelTimeMinutes: number | null; workTimeMinutes: number | null; totalTimeMinutes: number | null; laborCost: string | null; partsCost: string | null; travelCost: string | null; otherCost: string | null; partsUsed: string | null; relatedTicketId: string | null; attachmentIds: string | null; customerSatisfaction: number | null; customerFeedback: string | null; internalNotes: string | null; }>; /** * Update service ticket */ updateTicket(ticketId: string, tenantId: string, data: Partial<{ ticketType: string; priority: string; status: string; subject: string; description: string; problemCategory: string; errorCode: string; serviceLocationId: string; serviceAddress: string; assignedToId: string; assignedTeamId: string; scheduledAt: string; resolutionSummary: string; resolutionCode: string; rootCause: string; preventiveAction: string; travelTimeMinutes: number; workTimeMinutes: number; laborCost: number; partsCost: number; travelCost: number; otherCost: number; partsUsed: any[]; attachmentIds: string[]; signatureImageId: string; customerSatisfaction: number; customerFeedback: string; internalNotes: string; }>, userId?: string): Promise<{ id: string; tenantId: string; ticketNumber: string; contractId: string | null; isBillable: boolean; customerId: string; contactPersonId: string | null; assetId: string | null; ticketType: "preventive" | "inspection" | "incident" | "request" | "corrective" | "installation" | "training" | "consultation"; priority: "medium" | "critical" | "high" | "low"; status: "cancelled" | "open" | "assigned" | "in_progress" | "pending_customer" | "pending_parts" | "on_hold" | "resolved" | "closed"; source: "email" | "scheduled" | "customer_portal" | "phone" | "chat" | "field_technician" | "system_alert" | "internal"; subject: string; description: string | null; problemCategory: string | null; errorCode: string | null; serviceLocationId: string | null; serviceAddress: string | null; assignedToId: string | null; assignedTeamId: string | null; slaResponseDue: Date | null; slaResolutionDue: Date | null; firstResponseAt: Date | null; reportedAt: Date; acknowledgedAt: Date | null; scheduledAt: Date | null; startedAt: Date | null; resolvedAt: Date | null; closedAt: Date | null; resolutionSummary: string | null; resolutionCode: string | null; rootCause: string | null; preventiveAction: string | null; travelTimeMinutes: number | null; workTimeMinutes: number | null; totalTimeMinutes: number | null; laborCost: string | null; partsCost: string | null; travelCost: string | null; otherCost: string | null; totalCost: string | null; currency: string | null; partsUsed: string | null; maintenanceRecordId: string | null; calibrationRecordId: string | null; relatedTicketId: string | null; attachmentIds: string | null; signatureImageId: string | null; customerSatisfaction: number | null; customerFeedback: string | null; internalNotes: string | null; metadata: string | null; insertedAt: Date; updatedAt: Date; deletedAt: Date | null; } | null>; /** * Delete service ticket (soft delete) */ deleteTicket(ticketId: string, tenantId: string): Promise; /** * Get comments for a ticket */ getTicketComments(ticketId: string, tenantId: string, includeInternal?: boolean): Promise<{ id: string; tenantId: string; ticketId: string; authorId: string; content: string; isInternal: boolean; isSystemGenerated: boolean; attachmentIds: string | null; insertedAt: Date; }[]>; /** * Add comment to ticket */ addTicketComment(ticketId: string, tenantId: string, data: { content: string; isInternal?: boolean; attachmentIds?: string[]; }, authorId: string): Promise<{ id: string; insertedAt: Date; tenantId: string; attachmentIds: string | null; ticketId: string; authorId: string; content: string; isInternal: boolean; isSystemGenerated: boolean; }>; /** * Get status history for a ticket */ getTicketStatusHistory(ticketId: string, tenantId: string): Promise<{ id: string; tenantId: string; ticketId: string; previousStatus: string | null; newStatus: string; changedById: string | null; reason: string | null; changedAt: Date; }[]>; /** * Get ticket statistics */ getTicketStatistics(tenantId: string, dateRange?: { from: string; to: string; }): Promise<{ total: number; byStatus: Record; byPriority: Record; byType: Record; }>; } //# sourceMappingURL=service.d.ts.map