<?php
namespace App\Services;use App\Models\{ProfileAudit,User};use Illuminate\Support\Str;
final class ProfileAuditLogger{public function record(string$action,User$actor,array$before=[],array$after=[]):void{ProfileAudit::create(['actor_user_id'=>$actor->id,'action'=>$action,'correlation_id'=>(string)Str::uuid(),'before'=>$before?:null,'after'=>$after?:null,'result'=>'success']);}public function mask(string$email):string{[$local,$domain]=array_pad(explode('@',$email,2),2,'');return mb_substr($local,0,1).'***@'.$domain;}}
