feat: implement AI styling foundation and billing scope rework
This commit is contained in:
39
app/Services/AiEditing/Safety/AiSafetyDecision.php
Normal file
39
app/Services/AiEditing/Safety/AiSafetyDecision.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\AiEditing\Safety;
|
||||
|
||||
class AiSafetyDecision
|
||||
{
|
||||
/**
|
||||
* @param array<int, string> $reasonCodes
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly bool $blocked,
|
||||
public readonly string $state,
|
||||
public readonly array $reasonCodes = [],
|
||||
public readonly ?string $failureCode = null,
|
||||
public readonly ?string $failureMessage = null,
|
||||
) {}
|
||||
|
||||
public static function passed(): self
|
||||
{
|
||||
return new self(
|
||||
blocked: false,
|
||||
state: 'passed',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, string> $reasonCodes
|
||||
*/
|
||||
public static function blocked(array $reasonCodes, string $failureCode, string $failureMessage): self
|
||||
{
|
||||
return new self(
|
||||
blocked: true,
|
||||
state: 'blocked',
|
||||
reasonCodes: array_values(array_unique($reasonCodes)),
|
||||
failureCode: $failureCode,
|
||||
failureMessage: $failureMessage,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user