packages/sql-semantics-mysql/resources/models/Value/EventTailWithRememberNameEventSymOptIfNotExistsSpNameOnScheduleSymEvScheduleTimeOptEvOnC_6c29f016.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\EventTailWithRememberNameEventSymOptIfNotExistsSpNameOnScheduleSymEvScheduleTimeOptEvOnC_6c29f016 $value): string => \SqlSemantics\Statement\Writer::render($value);
13 * $write instanceof \Closure // => true
14 */
15final class EventTailWithRememberNameEventSymOptIfNotExistsSpNameOnScheduleSymEvScheduleTimeOptEvOnC_6c29f016 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\RememberNameForm $rememberName,
24 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptIfNotExistsForm $optIfNotExists,
25 public readonly \SqlSemantics\Statement\Model\MySql\Role\SpNameForm $spName,
26 public readonly \SqlSemantics\Statement\Model\MySql\Role\EvScheduleTimeForm $evScheduleTime,
27 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptEvOnCompletionForm $optEvOnCompletion,
28 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptEvStatusForm $optEvStatus,
29 public readonly \SqlSemantics\Statement\Model\MySql\Role\OptEvCommentForm $optEvComment,
30 public readonly \SqlSemantics\Statement\Model\MySql\Role\EvSqlStmtForm $evSqlStmt,
31 public readonly \SqlSemantics\Statement\Comments $comments = new \SqlSemantics\Statement\Comments(),
32 ) {
33 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($rememberName), 'The rememberName must be a generated immutable SQL value.');
34 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optIfNotExists), 'The optIfNotExists must be a generated immutable SQL value.');
35 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($spName), 'The spName must be a generated immutable SQL value.');
36 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($evScheduleTime), 'The evScheduleTime must be a generated immutable SQL value.');
37 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optEvOnCompletion), 'The optEvOnCompletion must be a generated immutable SQL value.');
38 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optEvStatus), 'The optEvStatus must be a generated immutable SQL value.');
39 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($optEvComment), 'The optEvComment must be a generated immutable SQL value.');
40 $this->assert(\SqlSemantics\Statement\Model\MySql\Contract\Contracts::contains($evSqlStmt), 'The evSqlStmt must be a generated immutable SQL value.');
41 }
42
43 /**
44 * Writes SQL entirely from this value's fields.
45 */
46 public function write(\SqlSemantics\Statement\Writer $writer): void
47 {
48 $writer->comments($this->comments, 0);
49 $this->rememberName->write($writer);
50 $writer->comments($this->comments, 1);
51 $writer->append('EVENT');
52 $writer->comments($this->comments, 2);
53 $this->optIfNotExists->write($writer);
54 $writer->comments($this->comments, 3);
55 $this->spName->write($writer);
56 $writer->comments($this->comments, 4);
57 $writer->append('ON');
58 $writer->comments($this->comments, 5);
59 $writer->append('SCHEDULE');
60 $writer->comments($this->comments, 6);
61 $this->evScheduleTime->write($writer);
62 $writer->comments($this->comments, 7);
63 $this->optEvOnCompletion->write($writer);
64 $writer->comments($this->comments, 8);
65 $this->optEvStatus->write($writer);
66 $writer->comments($this->comments, 9);
67 $this->optEvComment->write($writer);
68 $writer->comments($this->comments, 10);
69 $writer->append('DO');
70 $writer->comments($this->comments, 11);
71 $this->evSqlStmt->write($writer);
72 }
73
74 /**
75 * Returns a copy with a new rememberName, preserving every other field.
76 */
77 public function withRememberName(\SqlSemantics\Statement\Model\MySql\Role\RememberNameForm $rememberName): self
78 {
79 return new self($rememberName, $this->optIfNotExists, $this->spName, $this->evScheduleTime, $this->optEvOnCompletion, $this->optEvStatus, $this->optEvComment, $this->evSqlStmt, $this->comments);
80 }
81
82 /**
83 * Returns a copy with a new optIfNotExists, preserving every other field.
84 */
85 public function withOptIfNotExists(\SqlSemantics\Statement\Model\MySql\Role\OptIfNotExistsForm $optIfNotExists): self
86 {
87 return new self($this->rememberName, $optIfNotExists, $this->spName, $this->evScheduleTime, $this->optEvOnCompletion, $this->optEvStatus, $this->optEvComment, $this->evSqlStmt, $this->comments);
88 }
89
90 /**
91 * Returns a copy with a new spName, preserving every other field.
92 */
93 public function withSpName(\SqlSemantics\Statement\Model\MySql\Role\SpNameForm $spName): self
94 {
95 return new self($this->rememberName, $this->optIfNotExists, $spName, $this->evScheduleTime, $this->optEvOnCompletion, $this->optEvStatus, $this->optEvComment, $this->evSqlStmt, $this->comments);
96 }
97
98 /**
99 * Returns a copy with a new evScheduleTime, preserving every other field.
100 */
101 public function withEvScheduleTime(\SqlSemantics\Statement\Model\MySql\Role\EvScheduleTimeForm $evScheduleTime): self
102 {
103 return new self($this->rememberName, $this->optIfNotExists, $this->spName, $evScheduleTime, $this->optEvOnCompletion, $this->optEvStatus, $this->optEvComment, $this->evSqlStmt, $this->comments);
104 }
105
106 /**
107 * Returns a copy with a new optEvOnCompletion, preserving every other field.
108 */
109 public function withOptEvOnCompletion(\SqlSemantics\Statement\Model\MySql\Role\OptEvOnCompletionForm $optEvOnCompletion): self
110 {
111 return new self($this->rememberName, $this->optIfNotExists, $this->spName, $this->evScheduleTime, $optEvOnCompletion, $this->optEvStatus, $this->optEvComment, $this->evSqlStmt, $this->comments);
112 }
113
114 /**
115 * Returns a copy with a new optEvStatus, preserving every other field.
116 */
117 public function withOptEvStatus(\SqlSemantics\Statement\Model\MySql\Role\OptEvStatusForm $optEvStatus): self
118 {
119 return new self($this->rememberName, $this->optIfNotExists, $this->spName, $this->evScheduleTime, $this->optEvOnCompletion, $optEvStatus, $this->optEvComment, $this->evSqlStmt, $this->comments);
120 }
121
122 /**
123 * Returns a copy with a new optEvComment, preserving every other field.
124 */
125 public function withOptEvComment(\SqlSemantics\Statement\Model\MySql\Role\OptEvCommentForm $optEvComment): self
126 {
127 return new self($this->rememberName, $this->optIfNotExists, $this->spName, $this->evScheduleTime, $this->optEvOnCompletion, $this->optEvStatus, $optEvComment, $this->evSqlStmt, $this->comments);
128 }
129
130 /**
131 * Returns a copy with a new evSqlStmt, preserving every other field.
132 */
133 public function withEvSqlStmt(\SqlSemantics\Statement\Model\MySql\Role\EvSqlStmtForm $evSqlStmt): self
134 {
135 return new self($this->rememberName, $this->optIfNotExists, $this->spName, $this->evScheduleTime, $this->optEvOnCompletion, $this->optEvStatus, $this->optEvComment, $evSqlStmt, $this->comments);
136 }
137
138 /**
139 * Returns a copy with a new comments, preserving every other field.
140 */
141 public function withComments(\SqlSemantics\Statement\Comments $comments): self
142 {
143 return new self($this->rememberName, $this->optIfNotExists, $this->spName, $this->evScheduleTime, $this->optEvOnCompletion, $this->optEvStatus, $this->optEvComment, $this->evSqlStmt, $comments);
144 }
145}
146