Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
AutoPopulateRolePlayProjectRequest
100.00% covered (success)
100.00%
9 / 9
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%
8 / 8
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 auto-populating roleplay project data from a website URL.
11 *
12 * The backend scrapes the provided website URL to extract company/product
13 * information, then uses AI to generate a complete roleplay project structure
14 * including customer profiles and objections.
15 *
16 * @property string $website_url The URL of the company/product website to analyze
17 * @property string|null $call_type Optional call type (cold-call or discovery-call). If omitted, AI will infer the best fit.
18 * @property int|null $difficulty Optional difficulty level 1-5. If omitted, defaults to 3 (medium).
19 */
20class AutoPopulateRolePlayProjectRequest extends FormRequest
21{
22    /**
23     * Determine if the user is authorized to make this request.
24     */
25    public function authorize(): bool
26    {
27        return true;
28    }
29
30    /**
31     * Get the validation rules that apply to the request.
32     *
33     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
34     */
35    public function rules(): array
36    {
37        return [
38            'website_url' => ['required', 'url', 'max:2048'],
39            'call_type' => ['sometimes', 'nullable', 'string', Rule::in([
40                RolePlayProjects::$COLD_CALL,
41                RolePlayProjects::$DISCOVERY_CALL,
42            ])],
43            'difficulty' => ['sometimes', 'nullable', 'integer', 'min:1', 'max:5'],
44        ];
45    }
46}