summaryrefslogtreecommitdiff
path: root/matrix-specification/Data/PushRule.php
blob: 2217a788fedbe3296505082ce2d728c4ca3929ca (plain)
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
<?php

namespace Matrix\Data;

class PushRule implements \JsonSerializable
{
  /**
   * @param array<string|array> $actions
   * @param PushCondition[] $conditions
   */
  public function __construct(
    private array $actions,
    private bool $default,
    private bool $enabled,
    private string $ruleId,
    private ?array $conditions = null,
    private ?string $pattern = null,
  )
  {}

  public function jsonSerialize(): array
  {
    return [
      "actions" => $this->actions,
      "conditions" => $this->conditions,
      "default" => $this->default,
      "enabled" => $this->enabled,
      "pattern" => $this->pattern,
      "rule_id" => $this->ruleId,
    ];
  }
}