Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
18 / 18 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| RolePlayPersonaTemplateResource | |
100.00% |
18 / 18 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| toArray | |
100.00% |
18 / 18 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Resources\v2; |
| 4 | |
| 5 | use Illuminate\Http\Resources\Json\JsonResource; |
| 6 | |
| 7 | /** |
| 8 | * Resource for the RolePlayPersonaTemplate model. |
| 9 | * |
| 10 | * Templates store the reusable parts of a persona (Persona Details + |
| 11 | * Product Details, optional default objections) without any |
| 12 | * customer_profiles. The frontend uses these to seed new persona forms. |
| 13 | * |
| 14 | * @property string $_id Template ID |
| 15 | * @property string $name Display name |
| 16 | * @property string|null $description Short description |
| 17 | * @property string $type Call type |
| 18 | * @property int $difficulty_level Difficulty (1-5) |
| 19 | * @property array<int, string> $industry Target industries |
| 20 | * @property array<int, string> $target_job_titles Buyer job titles |
| 21 | * @property array<int, string> $company_sizes Targeted company sizes |
| 22 | * @property array<int, string> $key_features Product key features |
| 23 | * @property string|null $product_description Product description |
| 24 | * @property array<int, mixed> $objections Objection blocks |
| 25 | * @property string $visibility personal|company |
| 26 | * @property string $user_id Owner user id |
| 27 | * @property string|null $company_id Owning company id (when visibility=company) |
| 28 | * @property \Carbon\Carbon|null $created_at |
| 29 | * @property \Carbon\Carbon|null $updated_at |
| 30 | */ |
| 31 | class RolePlayPersonaTemplateResource extends JsonResource |
| 32 | { |
| 33 | /** |
| 34 | * @return array<string, mixed> |
| 35 | */ |
| 36 | public function toArray($request): array |
| 37 | { |
| 38 | return [ |
| 39 | 'id' => (string) $this->_id, |
| 40 | 'name' => $this->name, |
| 41 | 'description' => $this->description, |
| 42 | 'type' => $this->type, |
| 43 | 'difficulty_level' => (int) $this->difficulty_level, |
| 44 | 'industry' => $this->industry ?? [], |
| 45 | 'target_job_titles' => $this->target_job_titles ?? [], |
| 46 | 'company_sizes' => $this->company_sizes ?? [], |
| 47 | 'key_features' => $this->key_features ?? [], |
| 48 | 'product_description' => $this->product_description, |
| 49 | 'objections' => $this->objections ?? [], |
| 50 | 'visibility' => $this->visibility, |
| 51 | 'user_id' => (string) $this->user_id, |
| 52 | 'company_id' => $this->company_id ? (string) $this->company_id : null, |
| 53 | 'created_at' => $this->created_at?->timestamp, |
| 54 | 'updated_at' => $this->updated_at?->timestamp, |
| 55 | ]; |
| 56 | } |
| 57 | } |