Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
20 / 20
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
RegenerateICPRolePlayProjectRequest
100.00% covered (success)
100.00%
20 / 20
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 authorize
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 rules
100.00% covered (success)
100.00%
19 / 19
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Http\Requests\v2\RolePlay;
4
5use App\Http\Models\RolePlayProjects;
6use Illuminate\Foundation\Http\FormRequest;
7use Illuminate\Validation\Rule;
8
9/**
10 * Request for regenerating a single ICP while preserving identity fields.
11 *
12 * The endpoint refreshes pain_points, budget, decision_making, urgency_level,
13 * communication_style, current_solution and openess_to_new_solutions, while
14 * keeping the prospect's identity (name, gender, image, company_name,
15 * company_size, industry, target_job_title, personality) untouched.
16 *
17 * @property string $type Call type (cold-call|discovery-call)
18 * @property int $difficulty_level Difficulty level (1-5)
19 * @property string $product_description Product description
20 * @property array<int, string> $industry Persona target industries
21 * @property array<int, string>|null $key_features Key product features
22 * @property int|null $id ICP id (preserved)
23 * @property string $name Prospect name (preserved)
24 * @property string $gender Prospect gender male|female (preserved)
25 * @property string|null $image Avatar image URL (preserved)
26 * @property array<string, mixed>|string|null $personality MBTI personality (preserved)
27 * @property string $company_name Company name (preserved)
28 * @property string $company_size Company size label (preserved, freeform)
29 * @property string $icp_industry ICP-specific industry (preserved)
30 * @property string $target_job_title Prospect job title (preserved)
31 * @property string|null $budget Existing budget (used as starting point only)
32 */
33class RegenerateICPRolePlayProjectRequest extends FormRequest
34{
35    /**
36     * Determine if the user is authorized to make this request.
37     */
38    public function authorize(): bool
39    {
40        return true;
41    }
42
43    /**
44     * Get the validation rules that apply to the request.
45     *
46     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
47     */
48    public function rules(): array
49    {
50        return [
51            // Persona context
52            'type' => ['required', 'string', Rule::in([RolePlayProjects::$COLD_CALL, RolePlayProjects::$DISCOVERY_CALL])],
53            'difficulty_level' => ['required', 'integer', 'min:1', 'max:5'],
54            'product_description' => ['required', 'string'],
55            'industry' => ['required', 'array', 'min:1'],
56            'industry.*' => ['string', 'max:255'],
57            'key_features' => ['nullable', 'array'],
58            'key_features.*' => ['string', 'max:255'],
59
60            // ICP fields to preserve
61            'id' => ['nullable', 'integer'],
62            'name' => ['required', 'string', 'max:255'],
63            'gender' => ['required', 'string', 'in:male,female'],
64            'image' => ['nullable', 'string'],
65            'personality' => ['nullable'],
66            'company_name' => ['required', 'string', 'max:255'],
67            'company_size' => ['required', 'string', 'max:255'],
68            'icp_industry' => ['required', 'string', 'max:255'],
69            'target_job_title' => ['required', 'string', 'max:255'],
70            'budget' => ['nullable', 'string', 'max:255'],
71        ];
72    }
73}