20 lines
505 B
PHP
20 lines
505 B
PHP
<?php
|
|||
|
|
declare( strict_types=1 );
|
||
|
|
|
||
|
|
namespace StreamGoals\Rules;
|
||
|
|
|
||
|
|
/** A stored rule row: id, goal, type (add_time|counter|bonus) and decoded config. */
|
||
|
|
final class RuleDef {
|
||
|
|
|
||
|
|
public function __construct(
|
||
|
|
public readonly int $id,
|
||
|
|
public readonly int $goalId,
|
||
|
|
public readonly string $type,
|
||
|
|
public readonly array $config
|
||
|
|
) {}
|
||
|
|
|
||
|
|
/** Per-rule "reverse on refund" flag; defaults to true. */
|
||
|
|
public function reverseOnRefund(): bool {
|
||
|
|
return (bool) ( $this->config['reverse_on_refund'] ?? true );
|
||
|
|
}
|
||
|
|
}
|