Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
RolePlaySkillProgressions
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
2 / 2
4
100.00% covered (success)
100.00%
1 / 1
 newFactory
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getScorecard
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
3
1<?php
2
3namespace App\Http\Models;
4
5use Database\Factories\Http\Models\RolePlaySkillProgressionsFactory;
6use Illuminate\Database\Eloquent\Factories\HasFactory;
7
8class RolePlaySkillProgressions extends Moloquent
9{
10    use HasFactory;
11
12    public static $COLD_CALL_SCORECARD = [
13        [
14            'name' => 'Introduction',
15            'is_default' => true,
16            'weight' => 10,
17            'criteria' => [
18                [
19                    'name' => 'Opening Line',
20                    'weight' => 50,
21                    'description' => 'Assess the effectiveness of the opening line in capturing attention and setting a positive tone.',
22                ],
23                [
24                    'name' => 'Purpose of Call',
25                    'weight' => 50,
26                    'description' => 'Judge how clearly and concisely the reason for the call is stated.',
27                ],
28            ],
29        ],
30        [
31            'name' => 'Preparation',
32            'is_default' => true,
33            'weight' => 5,
34            'criteria' => [
35                [
36                    'name' => 'Background Knowledge',
37                    'weight' => 50,
38                    'description' => "Assess the caller's understanding of the prospect's industry and company.",
39                ],
40                [
41                    'name' => 'Customization',
42                    'weight' => 50,
43                    'description' => 'Evaluate how well the call is tailored to the prospect’s profile.',
44                ],
45            ],
46        ],
47        [
48            'name' => 'Rapport Building',
49            'is_default' => true,
50            'weight' => 15,
51            'criteria' => [
52                [
53                    'name' => 'Engagement Questions',
54                    'weight' => 50,
55                    'description' => 'Rate the ability to ask relevant, open-ended questions that engage the prospect and gather preliminary information.',
56                ],
57                [
58                    'name' => 'Listening Skills',
59                    'weight' => 50,
60                    'description' => 'Score the demonstration of active listening, such as acknowledging the prospect’s responses and tailoring the conversation accordingly.',
61                ],
62            ],
63        ],
64        [
65            'name' => 'Value Proposition',
66            'is_default' => true,
67            'weight' => 15,
68            'criteria' => [
69                [
70                    'name' => 'Clarity of Value Proposition',
71                    'weight' => 50,
72                    'description' => 'Evaluate the effectiveness of communicating the unique benefits of the product/service within the first few minutes.',
73                ],
74                [
75                    'name' => 'Relevance to Prospect',
76                    'weight' => 50,
77                    'description' => 'Assess how well the value proposition is tailored to the prospect’s potential needs or pain points as understood during the call.',
78                ],
79            ],
80        ],
81        [
82            'name' => 'Handling Initial Objections',
83            'is_default' => true,
84            'weight' => 15,
85            'criteria' => [
86                [
87                    'name' => 'Preparation and Anticipation',
88                    'weight' => 50,
89                    'description' => 'Score the preparedness for common objections specific to cold calls, such as time constraints or lack of interest.',
90                ],
91                [
92                    'name' => 'Response Quality',
93                    'weight' => 50,
94                    'description' => 'Evaluate the persuasiveness and appropriateness of responses to overcome objections and maintain engagement.',
95                ],
96            ],
97        ],
98        [
99            'name' => 'Call to Action',
100            'is_default' => true,
101            'weight' => 5,
102            'criteria' => [
103                [
104                    'name' => 'Clarity and Directness',
105                    'weight' => 30,
106                    'description' => 'Rate the clear articulation of the desired next step or action.',
107                ],
108                [
109                    'name' => 'Persuasiveness',
110                    'weight' => 35,
111                    'description' => 'Assess the effectiveness in encouraging the prospect to agree to the proposed action.',
112                ],
113                [
114                    'name' => 'Adaptability',
115                    'weight' => 35,
116                    'description' => 'Evaluate the ability to adapt the call to action based on the conversation and cues from the prospect.',
117                ],
118            ],
119        ],
120        [
121            'name' => 'Professionalism and Tone',
122            'is_default' => true,
123            'weight' => 5,
124            'criteria' => [
125                [
126                    'name' => 'Communication Style',
127                    'weight' => 100,
128                    'description' => 'Score the professionalism in tone, language, and manner of speaking.',
129                ],
130            ],
131        ],
132        [
133            'name' => 'Main Objective: Securing Follow-Up',
134            'is_default' => true,
135            'weight' => 20,
136            'criteria' => [
137                [
138                    'name' => 'Securing a Follow-Up',
139                    'weight' => 50,
140                    'description' => 'Score the success in securing a concrete follow-up meeting. 10 = specific meeting confirmed with date/time agreed. 7-8 = verbal agreement to meet without finalized details. 4-5 = prospect expressed openness to continuing the conversation. 1 = no follow-up or next step was secured.',
141                ],
142                [
143                    'name' => 'Persistence Under Resistance',
144                    'weight' => 33,
145                    'description' => 'Rate how effectively the rep handled pushback and continued pursuing the close when facing objections. 10 = overcame multiple objections and maintained momentum toward a follow-up. 5 = addressed one objection but backed off early when met with further resistance. 1 = gave up at the first sign of pushback without attempting to re-engage.',
146                ],
147                [
148                    'name' => 'Proactive Close Attempt',
149                    'weight' => 17,
150                    'description' => 'Evaluate whether the rep took initiative to directly ask for next steps. 10 = made a clear, direct ask for a meeting or follow-up. 5 = hinted at next steps or expressed interest in continuing without making a specific ask. 1 = never attempted to close or propose a follow-up action.',
151                ],
152            ],
153        ],
154    ];
155
156    public static $DISCOVERY_CALL = [
157        [
158            'name' => 'Preparation and Research',
159            'is_default' => true,
160            'weight' => 5,
161            'criteria' => [
162                [
163                    'name' => 'Company Knowledge',
164                    'weight' => 35,
165                    'description' => 'Assess the depth of understanding of the prospect’s company, industry, and market position.',
166                ],
167                [
168                    'name' => 'Prospect Knowledge',
169                    'weight' => 35,
170                    'description' => 'Evaluate the familiarity with the prospect’s role, background, and professional history.',
171                ],
172                [
173                    'name' => 'Objective Setting',
174                    'weight' => 30,
175                    'description' => 'Judge the clarity and relevance of the goals and objectives set for the call.',
176                ],
177            ],
178        ],
179        [
180            'name' => 'Building Rapport and Trust',
181            'is_default' => true,
182            'weight' => 15,
183            'criteria' => [
184                [
185                    'name' => 'Introduction',
186                    'weight' => 35,
187                    'description' => 'Rate the effectiveness of the warm and professional introduction in establishing credibility.',
188                ],
189                [
190                    'name' => 'Active Listening',
191                    'weight' => 35,
192                    'description' => 'Score the demonstration of genuine interest and attentive listening.',
193                ],
194                [
195                    'name' => 'Personal Connection',
196                    'weight' => 30,
197                    'description' => 'Evaluate the success in establishing a personal connection with the prospect.',
198                ],
199            ],
200        ],
201        [
202            'name' => 'Questioning and Probing',
203            'is_default' => true,
204            'weight' => 25,
205            'criteria' => [
206                [
207                    'name' => 'Open-Ended Questions',
208                    'weight' => 30,
209                    'description' => 'Assess the use of open-ended questions to encourage discussion.',
210                ],
211                [
212                    'name' => 'Probing for Needs',
213                    'weight' => 35,
214                    'description' => 'Evaluate the effectiveness in uncovering explicit and implicit needs.',
215                ],
216                [
217                    'name' => 'Clarification',
218                    'weight' => 35,
219                    'description' => 'Score the skill in seeking clarification and elaboration where needed.',
220                ],
221            ],
222        ],
223        [
224            'name' => 'Presenting Solutions',
225            'is_default' => true,
226            'weight' => 20,
227            'criteria' => [
228                [
229                    'name' => 'Solution Alignment',
230                    'weight' => 40,
231                    'description' => 'Assess how well the solutions presented align with the prospect’s needs.',
232                ],
233                [
234                    'name' => 'Value Proposition',
235                    'weight' => 30,
236                    'description' => 'Evaluate the clarity and persuasiveness of the value proposition.',
237                ],
238                [
239                    'name' => 'Customization',
240                    'weight' => 30,
241                    'description' => 'Rate the degree of customization of the solution to the specific context of the prospect.',
242                ],
243            ],
244        ],
245        [
246            'name' => 'Handling Objections',
247            'is_default' => true,
248            'weight' => 10,
249            'criteria' => [
250                [
251                    'name' => 'Anticipation',
252                    'weight' => 50,
253                    'description' => 'Score the preparation for potential objections specific to the discovery call.',
254                ],
255                [
256                    'name' => 'Response Quality',
257                    'weight' => 25,
258                    'description' => 'Evaluate the quality and effectiveness of responses to objections.',
259                ],
260                [
261                    'name' => 'Calm and Composed',
262                    'weight' => 25,
263                    'description' => 'Rate the ability to maintain composure and confidence while addressing objections.',
264                ],
265            ],
266        ],
267        [
268            'name' => 'Closing and Next Steps',
269            'is_default' => true,
270            'weight' => 10,
271            'criteria' => [
272                [
273                    'name' => 'Securing Commitment',
274                    'weight' => 50,
275                    'description' => 'Score the success in gaining a firm commitment from the prospect for next steps. 10 = specific action items agreed with dates. 7-8 = verbal commitment without details. 4-5 = general interest expressed. 1 = no commitment obtained.',
276                ],
277                [
278                    'name' => 'Persistence in Advancing',
279                    'weight' => 33,
280                    'description' => 'Rate how the rep handled hesitation and continued working toward a close. 10 = navigated multiple objections to reach agreement. 5 = tried once but accepted a soft deflection. 1 = did not push past initial hesitation.',
281                ],
282                [
283                    'name' => 'Proactive Next-Step Proposal',
284                    'weight' => 17,
285                    'description' => 'Evaluate whether the rep proactively proposed concrete next steps. 10 = clear, actionable proposal made. 5 = vague mention of following up. 1 = no proposal offered.',
286                ],
287            ],
288        ],
289        [
290            'name' => 'Overall Communication Skills',
291            'is_default' => true,
292            'weight' => 5,
293            'criteria' => [
294                [
295                    'name' => 'Clarity and Articulation',
296                    'weight' => 50,
297                    'description' => 'Rate the clarity and articulation of communication throughout the call.',
298                ],
299                [
300                    'name' => 'Professionalism',
301                    'weight' => 50,
302                    'description' => 'Score the maintenance of a professional demeanor during the conversation.',
303                ],
304            ],
305        ],
306    ];
307
308    protected $table = 'roleplay_skill_progression';
309
310    protected $fillable = [
311        'type',
312        'status',
313        'scorecard_config',
314    ];
315
316    protected static function newFactory()
317    {
318        return RolePlaySkillProgressionsFactory::new();
319    }
320
321    /**
322     * Get the default scorecard configuration for a given call type.
323     *
324     * Reads from the RolePlayConfig global document first (DB-seeded values),
325     * falling back to the hardcoded constants if no DB entry exists.
326     *
327     * @param string $callType The call type identifier (e.g., 'cold-call', 'discovery-call')
328     * @return array The scorecard configuration array
329     */
330    public static function getScorecard(string $callType): array
331    {
332        $config = RolePlayConfig::where('type', 'global')->first();
333        $seeded = $config?->default_scorecards[$callType] ?? null;
334
335        if ($seeded) {
336            return $seeded;
337        }
338
339        return $callType === 'cold-call'
340            ? self::$COLD_CALL_SCORECARD
341            : self::$DISCOVERY_CALL;
342    }
343}