GetApiV3MeReactions200ResponseDataInner.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <?php
  2. /**
  3. * GetApiV3MeReactions200ResponseDataInner
  4. *
  5. * PHP version 8.1
  6. *
  7. * @category Class
  8. * @package WikipaliApi
  9. * @author OpenAPI Generator team
  10. * @link https://openapi-generator.tech
  11. */
  12. /**
  13. * MINT API
  14. *
  15. * International Academy Of Pali Tipitaka(国际巴利三藏学院) 由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
  16. *
  17. * The version of the OpenAPI document: 2026.10.15
  18. * Generated by: https://openapi-generator.tech
  19. * Generator version: 7.25.0
  20. */
  21. /**
  22. * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
  23. * https://openapi-generator.tech
  24. * Do not edit the class manually.
  25. */
  26. namespace WikipaliApi\Model;
  27. use \ArrayAccess;
  28. use \WikipaliApi\ObjectSerializer;
  29. /**
  30. * GetApiV3MeReactions200ResponseDataInner Class Doc Comment
  31. *
  32. * @category Class
  33. * @package WikipaliApi
  34. * @author OpenAPI Generator team
  35. * @link https://openapi-generator.tech
  36. * @implements \ArrayAccess<string, mixed>
  37. */
  38. class GetApiV3MeReactions200ResponseDataInner implements ModelInterface, ArrayAccess, \JsonSerializable
  39. {
  40. public const DISCRIMINATOR = null;
  41. /**
  42. * The original name of the model.
  43. *
  44. * @var string
  45. */
  46. protected static $openAPIModelName = 'get_api_v3_me_reactions_200_response_data_inner';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $openAPITypes = [
  53. 'id' => 'string',
  54. 'type' => 'string',
  55. 'target_id' => 'string',
  56. 'target_type' => 'string',
  57. 'context' => 'string',
  58. 'created_at' => 'string',
  59. 'updated_at' => 'string',
  60. 'user' => '\WikipaliApi\Model\GetApiV3Discussions200ResponseDataInnerEditor'
  61. ];
  62. /**
  63. * Array of property to format mappings. Used for (de)serialization
  64. *
  65. * @var string[]
  66. * @phpstan-var array<string, string|null>
  67. * @psalm-var array<string, string|null>
  68. */
  69. protected static $openAPIFormats = [
  70. 'id' => null,
  71. 'type' => null,
  72. 'target_id' => null,
  73. 'target_type' => null,
  74. 'context' => null,
  75. 'created_at' => null,
  76. 'updated_at' => null,
  77. 'user' => null
  78. ];
  79. /**
  80. * Array of nullable properties. Used for (de)serialization
  81. *
  82. * @var boolean[]
  83. */
  84. protected static array $openAPINullables = [
  85. 'id' => false,
  86. 'type' => false,
  87. 'target_id' => false,
  88. 'target_type' => false,
  89. 'context' => true,
  90. 'created_at' => false,
  91. 'updated_at' => false,
  92. 'user' => true
  93. ];
  94. /**
  95. * If a nullable field gets set to null, insert it here
  96. *
  97. * @var boolean[]
  98. */
  99. protected array $openAPINullablesSetToNull = [];
  100. /**
  101. * Array of property to type mappings. Used for (de)serialization
  102. *
  103. * @return array
  104. */
  105. public static function openAPITypes()
  106. {
  107. return self::$openAPITypes;
  108. }
  109. /**
  110. * Array of property to format mappings. Used for (de)serialization
  111. *
  112. * @return array
  113. */
  114. public static function openAPIFormats()
  115. {
  116. return self::$openAPIFormats;
  117. }
  118. /**
  119. * Array of nullable properties
  120. *
  121. * @return array
  122. */
  123. protected static function openAPINullables(): array
  124. {
  125. return self::$openAPINullables;
  126. }
  127. /**
  128. * Array of nullable field names deliberately set to null
  129. *
  130. * @return boolean[]
  131. */
  132. private function getOpenAPINullablesSetToNull(): array
  133. {
  134. return $this->openAPINullablesSetToNull;
  135. }
  136. /**
  137. * Setter - Array of nullable field names deliberately set to null
  138. *
  139. * @param boolean[] $openAPINullablesSetToNull
  140. */
  141. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  142. {
  143. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  144. }
  145. /**
  146. * Checks if a property is nullable
  147. *
  148. * @param string $property
  149. * @return bool
  150. */
  151. public static function isNullable(string $property): bool
  152. {
  153. return self::openAPINullables()[$property] ?? false;
  154. }
  155. /**
  156. * Checks if a nullable property is set to null.
  157. *
  158. * @param string $property
  159. * @return bool
  160. */
  161. public function isNullableSetToNull(string $property): bool
  162. {
  163. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  164. }
  165. /**
  166. * Array of attributes where the key is the local name,
  167. * and the value is the original name
  168. *
  169. * @var string[]
  170. */
  171. protected static $attributeMap = [
  172. 'id' => 'id',
  173. 'type' => 'type',
  174. 'target_id' => 'target_id',
  175. 'target_type' => 'target_type',
  176. 'context' => 'context',
  177. 'created_at' => 'created_at',
  178. 'updated_at' => 'updated_at',
  179. 'user' => 'user'
  180. ];
  181. /**
  182. * Array of attributes to setter functions (for deserialization of responses)
  183. *
  184. * @var string[]
  185. */
  186. protected static $setters = [
  187. 'id' => 'setId',
  188. 'type' => 'setType',
  189. 'target_id' => 'setTargetId',
  190. 'target_type' => 'setTargetType',
  191. 'context' => 'setContext',
  192. 'created_at' => 'setCreatedAt',
  193. 'updated_at' => 'setUpdatedAt',
  194. 'user' => 'setUser'
  195. ];
  196. /**
  197. * Array of attributes to getter functions (for serialization of requests)
  198. *
  199. * @var string[]
  200. */
  201. protected static $getters = [
  202. 'id' => 'getId',
  203. 'type' => 'getType',
  204. 'target_id' => 'getTargetId',
  205. 'target_type' => 'getTargetType',
  206. 'context' => 'getContext',
  207. 'created_at' => 'getCreatedAt',
  208. 'updated_at' => 'getUpdatedAt',
  209. 'user' => 'getUser'
  210. ];
  211. /**
  212. * Array of attributes where the key is the local name,
  213. * and the value is the original name
  214. *
  215. * @return array
  216. */
  217. public static function attributeMap()
  218. {
  219. return self::$attributeMap;
  220. }
  221. /**
  222. * Array of attributes to setter functions (for deserialization of responses)
  223. *
  224. * @return array
  225. */
  226. public static function setters()
  227. {
  228. return self::$setters;
  229. }
  230. /**
  231. * Array of attributes to getter functions (for serialization of requests)
  232. *
  233. * @return array
  234. */
  235. public static function getters()
  236. {
  237. return self::$getters;
  238. }
  239. /**
  240. * The original name of the model.
  241. *
  242. * @return string
  243. */
  244. public function getModelName()
  245. {
  246. return self::$openAPIModelName;
  247. }
  248. /**
  249. * Associative array for storing property values
  250. *
  251. * @var mixed[]
  252. */
  253. protected $container = [];
  254. /**
  255. * Constructor
  256. *
  257. * @param mixed[]|null $data Associated array of property values
  258. * initializing the model
  259. */
  260. public function __construct(?array $data = null)
  261. {
  262. $this->setIfExists('id', $data ?? [], null);
  263. $this->setIfExists('type', $data ?? [], null);
  264. $this->setIfExists('target_id', $data ?? [], null);
  265. $this->setIfExists('target_type', $data ?? [], null);
  266. $this->setIfExists('context', $data ?? [], null);
  267. $this->setIfExists('created_at', $data ?? [], null);
  268. $this->setIfExists('updated_at', $data ?? [], null);
  269. $this->setIfExists('user', $data ?? [], null);
  270. }
  271. /**
  272. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  273. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  274. * $this->openAPINullablesSetToNull array
  275. *
  276. * @param string $variableName
  277. * @param array $fields
  278. * @param mixed $defaultValue
  279. */
  280. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  281. {
  282. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  283. $this->openAPINullablesSetToNull[] = $variableName;
  284. }
  285. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  286. }
  287. /**
  288. * Show all the invalid properties with reasons.
  289. *
  290. * @return array invalid properties with reasons
  291. */
  292. public function listInvalidProperties()
  293. {
  294. $invalidProperties = [];
  295. return $invalidProperties;
  296. }
  297. /**
  298. * Validate all the properties in the model
  299. * return true if all passed
  300. *
  301. * @return bool True if all properties are valid
  302. */
  303. public function valid()
  304. {
  305. return count($this->listInvalidProperties()) === 0;
  306. }
  307. /**
  308. * Gets id
  309. *
  310. * @return string|null
  311. */
  312. public function getId()
  313. {
  314. return $this->container['id'];
  315. }
  316. /**
  317. * Sets id
  318. *
  319. * @param string|null $id id
  320. *
  321. * @return self
  322. */
  323. public function setId($id)
  324. {
  325. if (is_null($id)) {
  326. throw new \InvalidArgumentException('non-nullable id cannot be null');
  327. }
  328. $this->container['id'] = $id;
  329. return $this;
  330. }
  331. /**
  332. * Gets type
  333. *
  334. * @return string|null
  335. */
  336. public function getType()
  337. {
  338. return $this->container['type'];
  339. }
  340. /**
  341. * Sets type
  342. *
  343. * @param string|null $type type
  344. *
  345. * @return self
  346. */
  347. public function setType($type)
  348. {
  349. if (is_null($type)) {
  350. throw new \InvalidArgumentException('non-nullable type cannot be null');
  351. }
  352. $this->container['type'] = $type;
  353. return $this;
  354. }
  355. /**
  356. * Gets target_id
  357. *
  358. * @return string|null
  359. */
  360. public function getTargetId()
  361. {
  362. return $this->container['target_id'];
  363. }
  364. /**
  365. * Sets target_id
  366. *
  367. * @param string|null $target_id target_id
  368. *
  369. * @return self
  370. */
  371. public function setTargetId($target_id)
  372. {
  373. if (is_null($target_id)) {
  374. throw new \InvalidArgumentException('non-nullable target_id cannot be null');
  375. }
  376. $this->container['target_id'] = $target_id;
  377. return $this;
  378. }
  379. /**
  380. * Gets target_type
  381. *
  382. * @return string|null
  383. */
  384. public function getTargetType()
  385. {
  386. return $this->container['target_type'];
  387. }
  388. /**
  389. * Sets target_type
  390. *
  391. * @param string|null $target_type target_type
  392. *
  393. * @return self
  394. */
  395. public function setTargetType($target_type)
  396. {
  397. if (is_null($target_type)) {
  398. throw new \InvalidArgumentException('non-nullable target_type cannot be null');
  399. }
  400. $this->container['target_type'] = $target_type;
  401. return $this;
  402. }
  403. /**
  404. * Gets context
  405. *
  406. * @return string|null
  407. */
  408. public function getContext()
  409. {
  410. return $this->container['context'];
  411. }
  412. /**
  413. * Sets context
  414. *
  415. * @param string|null $context context
  416. *
  417. * @return self
  418. */
  419. public function setContext($context)
  420. {
  421. if (is_null($context)) {
  422. array_push($this->openAPINullablesSetToNull, 'context');
  423. } else {
  424. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  425. $index = array_search('context', $nullablesSetToNull);
  426. if ($index !== FALSE) {
  427. unset($nullablesSetToNull[$index]);
  428. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  429. }
  430. }
  431. $this->container['context'] = $context;
  432. return $this;
  433. }
  434. /**
  435. * Gets created_at
  436. *
  437. * @return string|null
  438. */
  439. public function getCreatedAt()
  440. {
  441. return $this->container['created_at'];
  442. }
  443. /**
  444. * Sets created_at
  445. *
  446. * @param string|null $created_at created_at
  447. *
  448. * @return self
  449. */
  450. public function setCreatedAt($created_at)
  451. {
  452. if (is_null($created_at)) {
  453. throw new \InvalidArgumentException('non-nullable created_at cannot be null');
  454. }
  455. $this->container['created_at'] = $created_at;
  456. return $this;
  457. }
  458. /**
  459. * Gets updated_at
  460. *
  461. * @return string|null
  462. */
  463. public function getUpdatedAt()
  464. {
  465. return $this->container['updated_at'];
  466. }
  467. /**
  468. * Sets updated_at
  469. *
  470. * @param string|null $updated_at updated_at
  471. *
  472. * @return self
  473. */
  474. public function setUpdatedAt($updated_at)
  475. {
  476. if (is_null($updated_at)) {
  477. throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
  478. }
  479. $this->container['updated_at'] = $updated_at;
  480. return $this;
  481. }
  482. /**
  483. * Gets user
  484. *
  485. * @return \WikipaliApi\Model\GetApiV3Discussions200ResponseDataInnerEditor|null
  486. */
  487. public function getUser()
  488. {
  489. return $this->container['user'];
  490. }
  491. /**
  492. * Sets user
  493. *
  494. * @param \WikipaliApi\Model\GetApiV3Discussions200ResponseDataInnerEditor|null $user user
  495. *
  496. * @return self
  497. */
  498. public function setUser($user)
  499. {
  500. if (is_null($user)) {
  501. array_push($this->openAPINullablesSetToNull, 'user');
  502. } else {
  503. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  504. $index = array_search('user', $nullablesSetToNull);
  505. if ($index !== FALSE) {
  506. unset($nullablesSetToNull[$index]);
  507. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  508. }
  509. }
  510. $this->container['user'] = $user;
  511. return $this;
  512. }
  513. /**
  514. * Returns true if offset exists. False otherwise.
  515. *
  516. * @param integer|string $offset Offset
  517. *
  518. * @return boolean
  519. */
  520. public function offsetExists(mixed $offset): bool
  521. {
  522. return isset($this->container[$offset]);
  523. }
  524. /**
  525. * Gets offset.
  526. *
  527. * @param integer|string $offset Offset
  528. *
  529. * @return mixed|null
  530. */
  531. #[\ReturnTypeWillChange]
  532. public function offsetGet(mixed $offset)
  533. {
  534. return $this->container[$offset] ?? null;
  535. }
  536. /**
  537. * Sets value based on offset.
  538. *
  539. * @param int|null $offset Offset
  540. * @param mixed $value Value to be set
  541. *
  542. * @return void
  543. */
  544. public function offsetSet($offset, $value): void
  545. {
  546. if (is_null($offset)) {
  547. $this->container[] = $value;
  548. } else {
  549. $this->container[$offset] = $value;
  550. }
  551. }
  552. /**
  553. * Unsets offset.
  554. *
  555. * @param integer|string $offset Offset
  556. *
  557. * @return void
  558. */
  559. public function offsetUnset(mixed $offset): void
  560. {
  561. unset($this->container[$offset]);
  562. }
  563. /**
  564. * Serializes the object to a value that can be serialized natively by json_encode().
  565. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  566. *
  567. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  568. * of any type other than a resource.
  569. */
  570. #[\ReturnTypeWillChange]
  571. public function jsonSerialize()
  572. {
  573. return ObjectSerializer::sanitizeForSerialization($this);
  574. }
  575. /**
  576. * Gets the string presentation of the object
  577. *
  578. * @return string
  579. */
  580. public function __toString()
  581. {
  582. return json_encode(
  583. ObjectSerializer::sanitizeForSerialization($this),
  584. JSON_PRETTY_PRINT
  585. );
  586. }
  587. /**
  588. * Gets a header-safe presentation of the object
  589. *
  590. * @return string
  591. */
  592. public function toHeaderValue()
  593. {
  594. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  595. }
  596. }