Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
AutoPopulateIcpsRequest
100.00% covered (success)
100.00%
12 / 12
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%
11 / 11
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 the ICPs auto-populate endpoint.
11 *
12 * Generates a fresh customer_profiles[] honoring the persona's call type,
13 * difficulty, target industries, product details, and selected company sizes.
14 *
15 * Mirrors GenerateICPRolePlayProjectRequest but adds the mandatory
16 * `company_sizes` field that drives the new size-aware ICP prompt.
17 *
18 * @property string $type Call type (cold-call|discovery-call)
19 * @property int $difficulty_level Difficulty level (1-5)
20 * @property string $product_description Product description (2-4 sentences)
21 * @property array<int, string> $industry Target industries (1+ entries)
22 * @property array<int, string>|null $key_features Key product features
23 * @property array<int, string> $company_sizes Targeted company sizes (subset of small|medium|large)
24 */
25class AutoPopulateIcpsRequest extends FormRequest
26{
27    /**
28     * Determine if the user is authorized to make this request.
29     */
30    public function authorize(): bool
31    {
32        return true;
33    }
34
35    /**
36     * Get the validation rules that apply to the request.
37     *
38     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
39     */
40    public function rules(): array
41    {
42        return [
43            'type' => ['required', 'string', Rule::in([RolePlayProjects::$COLD_CALL, RolePlayProjects::$DISCOVERY_CALL])],
44            'difficulty_level' => ['required', 'integer', 'min:1', 'max:5'],
45            'product_description' => ['required', 'string'],
46            'industry' => ['required', 'array', 'min:1'],
47            'industry.*' => ['string', 'max:255'],
48            'key_features' => ['nullable', 'array'],
49            'key_features.*' => ['string', 'max:255'],
50            'company_sizes' => ['required', 'array', 'min:1'],
51            'company_sizes.*' => ['required', 'string', Rule::in(RolePlayProjects::COMPANY_SIZE_KEYS)],
52        ];
53    }
54}