'date', 'metric_value' => 'decimal:2', 'additional_data' => 'array', ]; public function technician(): BelongsTo { return $this->belongsTo(Technician::class); } public static function getMetricTypes(): array { return [ 'jobs_completed' => 'Jobs Completed', 'hours_worked' => 'Hours Worked', 'billable_hours' => 'Billable Hours', 'revenue_generated' => 'Revenue Generated', 'customer_rating' => 'Customer Rating', 'efficiency_rate' => 'Efficiency Rate (%)', 'rework_rate' => 'Rework Rate (%)', 'safety_incidents' => 'Safety Incidents', 'training_hours' => 'Training Hours', 'overtime_hours' => 'Overtime Hours', ]; } public static function getPeriodTypes(): array { return [ 'daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly', 'quarterly' => 'Quarterly', 'yearly' => 'Yearly', ]; } public function getFormattedValueAttribute(): string { return match($this->metric_type) { 'revenue_generated' => '$' . number_format($this->metric_value, 2), 'customer_rating' => number_format($this->metric_value, 1) . '/5', 'efficiency_rate', 'rework_rate' => number_format($this->metric_value, 1) . '%', 'hours_worked', 'billable_hours', 'training_hours', 'overtime_hours' => number_format($this->metric_value, 1) . ' hrs', default => number_format($this->metric_value, 0), }; } }