packages/sql-semantics-mysql/resources/models/Value/EventTailWithEventSymOptIfNotExistsSpNameOnSymScheduleSymEvScheduleTimeOptEvOnCompletion_90fb9d80.php
1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Statement\Model\MySql\Value;
6
7/**
8 * The event_tail SQL value; generated by bin/build-models.php.
9 *
10 * @visibility public
11 * @example Accept a structured SQL value
12 * $write = static fn (\SqlSemantics\Statement\Model\MySql\Value\EventTailWithEventSymOptIfNotExistsSpNameOnSymScheduleSymEvScheduleTimeOptEvOnCompletion_90fb9d80 $value): string => \SqlSemantics\Statement\Writer::render($value);
13 * $write instanceof \Closure // => true
14 */
15final class EventTailWithEventSymOptIfNotExistsSpNameOnSymScheduleSymEvScheduleTimeOptEvOnCompletion_90fb9d80 implements \SqlSemantics\Statement\Model\MySql\Role\DefinerTailForm, \SqlSemantics\Statement\Model\MySql\Role\EventTailForm, \SqlSemantics\Statement\Model\MySql\Role\NoDefinerTailForm
16{
17 use \SqlSemantics\Statement\Assertion;
18
19 /**
20 * Supplies the SQL values of this form; comments are kept by the position of the symbol each precedes.
21 */
22 public function __construct(
23 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptIfNotExistsForm $optIfNotExists,
24 public readonly \SqlSemantics\Statement\Model\MySql\Role\SpNameForm $spName,
25 public readonly \SqlSemantics\Statement\Model\MySql\Role\EvScheduleTimeForm $evScheduleTime,
26 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptEvOnCompletionForm $optEvOnCompletion,
27 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptEvStatusForm $optEvStatus,
28 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptEvCommentForm $optEvComment,
29 public readonly \SqlSemantics\Statement\Model\MySql\Role\EvSqlStmtForm $evSqlStmt,
30 public readonly \SqlSemantics\Statement\Comments $comments = new \SqlSemantics\Statement\Comments(),
31 ) {
32 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optIfNotExists), 'The optIfNotExists must be a generated immutable SQL value.');
33 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($spName), 'The spName must be a generated immutable SQL value.');
34 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($evScheduleTime), 'The evScheduleTime must be a generated immutable SQL value.');
35 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optEvOnCompletion), 'The optEvOnCompletion must be a generated immutable SQL value.');
36 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optEvStatus), 'The optEvStatus must be a generated immutable SQL value.');
37 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optEvComment), 'The optEvComment must be a generated immutable SQL value.');
38 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($evSqlStmt), 'The evSqlStmt must be a generated immutable SQL value.');
39 }
40
41 /**
42 * Writes SQL entirely from this value's fields.
43 */
44 public function write(\SqlSemantics\Statement\Writer $writer): void
45 {
46 $writer->comments($this->comments, 0);
47 $writer->append('EVENT');
48 $writer->comments($this->comments, 1);
49 $this->optIfNotExists->write($writer);
50 $writer->comments($this->comments, 2);
51 $this->spName->write($writer);
52 $writer->comments($this->comments, 3);
53 $writer->append('ON');
54 $writer->comments($this->comments, 4);
55 $writer->append('SCHEDULE');
56 $writer->comments($this->comments, 5);
57 $this->evScheduleTime->write($writer);
58 $writer->comments($this->comments, 6);
59 $this->optEvOnCompletion->write($writer);
60 $writer->comments($this->comments, 7);
61 $this->optEvStatus->write($writer);
62 $writer->comments($this->comments, 8);
63 $this->optEvComment->write($writer);
64 $writer->comments($this->comments, 9);
65 $writer->append('DO');
66 $writer->comments($this->comments, 10);
67 $this->evSqlStmt->write($writer);
68 }
69
70 /**
71 * Returns a copy with a new optIfNotExists, preserving every other field.
72 */
73 public function withOptIfNotExists(\SqlSemantics\Statement\Model\MySql\Role\OptIfNotExistsForm $optIfNotExists): self
74 {
75 return new self($optIfNotExists, $this->spName, $this->evScheduleTime, $this->optEvOnCompletion, $this->optEvStatus, $this->optEvComment, $this->evSqlStmt, $this->comments);
76 }
77
78 /**
79 * Returns a copy with a new spName, preserving every other field.
80 */
81 public function withSpName(\SqlSemantics\Statement\Model\MySql\Role\SpNameForm $spName): self
82 {
83 return new self($this->optIfNotExists, $spName, $this->evScheduleTime, $this->optEvOnCompletion, $this->optEvStatus, $this->optEvComment, $this->evSqlStmt, $this->comments);
84 }
85
86 /**
87 * Returns a copy with a new evScheduleTime, preserving every other field.
88 */
89 public function withEvScheduleTime(\SqlSemantics\Statement\Model\MySql\Role\EvScheduleTimeForm $evScheduleTime): self
90 {
91 return new self($this->optIfNotExists, $this->spName, $evScheduleTime, $this->optEvOnCompletion, $this->optEvStatus, $this->optEvComment, $this->evSqlStmt, $this->comments);
92 }
93
94 /**
95 * Returns a copy with a new optEvOnCompletion, preserving every other field.
96 */
97 public function withOptEvOnCompletion(\SqlSemantics\Statement\Model\MySql\Role\OptEvOnCompletionForm $optEvOnCompletion): self
98 {
99 return new self($this->optIfNotExists, $this->spName, $this->evScheduleTime, $optEvOnCompletion, $this->optEvStatus, $this->optEvComment, $this->evSqlStmt, $this->comments);
100 }
101
102 /**
103 * Returns a copy with a new optEvStatus, preserving every other field.
104 */
105 public function withOptEvStatus(\SqlSemantics\Statement\Model\MySql\Role\OptEvStatusForm $optEvStatus): self
106 {
107 return new self($this->optIfNotExists, $this->spName, $this->evScheduleTime, $this->optEvOnCompletion, $optEvStatus, $this->optEvComment, $this->evSqlStmt, $this->comments);
108 }
109
110 /**
111 * Returns a copy with a new optEvComment, preserving every other field.
112 */
113 public function withOptEvComment(\SqlSemantics\Statement\Model\MySql\Role\OptEvCommentForm $optEvComment): self
114 {
115 return new self($this->optIfNotExists, $this->spName, $this->evScheduleTime, $this->optEvOnCompletion, $this->optEvStatus, $optEvComment, $this->evSqlStmt, $this->comments);
116 }
117
118 /**
119 * Returns a copy with a new evSqlStmt, preserving every other field.
120 */
121 public function withEvSqlStmt(\SqlSemantics\Statement\Model\MySql\Role\EvSqlStmtForm $evSqlStmt): self
122 {
123 return new self($this->optIfNotExists, $this->spName, $this->evScheduleTime, $this->optEvOnCompletion, $this->optEvStatus, $this->optEvComment, $evSqlStmt, $this->comments);
124 }
125
126 /**
127 * Returns a copy with a new comments, preserving every other field.
128 */
129 public function withComments(\SqlSemantics\Statement\Comments $comments): self
130 {
131 return new self($this->optIfNotExists, $this->spName, $this->evScheduleTime, $this->optEvOnCompletion, $this->optEvStatus, $this->optEvComment, $this->evSqlStmt, $comments);
132 }
133}
134