trim($runUuid), 'action' => $action, 'trigger_type' => $triggerType, 'status' => $status, 'reason_code' => $reasonCode !== null ? trim($reasonCode) : null, 'policy_deactivate_days' => max(0, (int) ($policy['deactivate_days'] ?? 0)), 'policy_delete_days' => max(0, (int) ($policy['delete_days'] ?? 0)), 'actor_user_id' => ($actorUserId ?? 0) > 0 ? (int) $actorUserId : null, 'target_user_id' => ((int) ($targetUser['id'] ?? 0)) > 0 ? (int) $targetUser['id'] : null, 'target_user_uuid' => self::stringOrNull($targetUser['uuid'] ?? null), 'target_user_email' => self::stringOrNull($targetUser['email'] ?? null), 'snapshot_enc' => null, 'snapshot_version' => self::SNAPSHOT_VERSION, ]; } private static function buildSnapshot(array $targetUser): array { $snapshot = []; foreach (self::SNAPSHOT_FIELDS as $field) { $snapshot[$field] = $targetUser[$field] ?? null; } return $snapshot; } private static function stringOrNull(mixed $value): ?string { $value = trim((string) $value); return $value !== '' ? $value : null; } }