File size: 2,043 Bytes
cf14c12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php

declare(strict_types=1);

namespace Voice\Domain\ValueObjects;

use JsonSerializable;
use Override;

enum Tone: string implements JsonSerializable
{
    case AUTHORITATIVE = 'authoritative';
    case PLEASANT = 'pleasant';
    case DEEP = 'deep';
    case RASPY = 'raspy';
    case WITCHY = 'witchy';
    case FOREIGNER = 'foreigner';
    case CHILDISH = 'childish';
    case ANGRY = 'angry';
    case CHEERFUL = 'cheerful';
    case SAD = 'sad';
    case EXCITED = 'excited';
    case FRIENDLY = 'friendly';
    case TERRIFIED = 'terrified';
    case SHOUTING = 'shouting';
    case UNFRIENDLY = 'unfriendly';
    case WHISPERING = 'whispering';
    case HOPEFUL = 'hopeful';
    case EMPATHETIC = 'empathetic';
    case CALM = 'calm';
    case DISGRUNTLED = 'disgruntled';
    case FEARFUL = 'fearful';
    case GENTLE = 'gentle';
    case SERIOUS = 'serious';
    case SORRY = 'sorry';
    case EMBARRASSED = 'embarrassed';
    case DEPRESSED = 'depressed';
    case ENVIOUS = 'envious';
    case LYRICAL = 'lyrical';
    case CASUAL = 'casual';

    case WELL_ROUNDED = 'well-rounded';
    case WAR_VETERAN = 'war-veteran';
    case GROUND_REPORTER = 'ground-reporter';
    case STRONG = 'strong';
    case SAILOR = 'sailor';
    case SOFT = 'soft';
    case WARM = 'warm';
    case EMOTIONAL = 'emotional';
    case INTENSE = 'intense';
    case SHOUTY = 'shouty';
    case ANXIOUS = 'anxious';
    case CRISP = 'crisp';
    case SEDUCTIVE = 'seductive';
    case CONFIDENT = 'confident';
    case OROTUND = 'orotund';
    case OVERHYPED = 'overhyped';
    case MATURE = 'mature';

    #[Override]
    public function jsonSerialize(): string
    {
        return $this->value;
    }

    public static function create(string $val): ?static
    {
        $value = trim(strtolower($val));
        $value = str_replace([' ', '_'], '-', $value);

        $map = [
            'whisper' => 'whispering',
            'witch' => 'witchy',
        ];

        $value = $map[$value] ?? $value;
        return self::tryFrom($value);
    }
}