PostApiV3Invites200ResponseData.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. <?php
  2. /**
  3. * PostApiV3Invites200ResponseData
  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.8
  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. * PostApiV3Invites200ResponseData 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 PostApiV3Invites200ResponseData 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 = 'post_api_v3_invites_200_response_data';
  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. 'email' => 'string',
  55. 'status' => 'string',
  56. 'created_at' => 'string'
  57. ];
  58. /**
  59. * Array of property to format mappings. Used for (de)serialization
  60. *
  61. * @var string[]
  62. * @phpstan-var array<string, string|null>
  63. * @psalm-var array<string, string|null>
  64. */
  65. protected static $openAPIFormats = [
  66. 'id' => null,
  67. 'email' => null,
  68. 'status' => null,
  69. 'created_at' => null
  70. ];
  71. /**
  72. * Array of nullable properties. Used for (de)serialization
  73. *
  74. * @var boolean[]
  75. */
  76. protected static array $openAPINullables = [
  77. 'id' => false,
  78. 'email' => false,
  79. 'status' => false,
  80. 'created_at' => true
  81. ];
  82. /**
  83. * If a nullable field gets set to null, insert it here
  84. *
  85. * @var boolean[]
  86. */
  87. protected array $openAPINullablesSetToNull = [];
  88. /**
  89. * Array of property to type mappings. Used for (de)serialization
  90. *
  91. * @return array
  92. */
  93. public static function openAPITypes()
  94. {
  95. return self::$openAPITypes;
  96. }
  97. /**
  98. * Array of property to format mappings. Used for (de)serialization
  99. *
  100. * @return array
  101. */
  102. public static function openAPIFormats()
  103. {
  104. return self::$openAPIFormats;
  105. }
  106. /**
  107. * Array of nullable properties
  108. *
  109. * @return array
  110. */
  111. protected static function openAPINullables(): array
  112. {
  113. return self::$openAPINullables;
  114. }
  115. /**
  116. * Array of nullable field names deliberately set to null
  117. *
  118. * @return boolean[]
  119. */
  120. private function getOpenAPINullablesSetToNull(): array
  121. {
  122. return $this->openAPINullablesSetToNull;
  123. }
  124. /**
  125. * Setter - Array of nullable field names deliberately set to null
  126. *
  127. * @param boolean[] $openAPINullablesSetToNull
  128. */
  129. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  130. {
  131. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  132. }
  133. /**
  134. * Checks if a property is nullable
  135. *
  136. * @param string $property
  137. * @return bool
  138. */
  139. public static function isNullable(string $property): bool
  140. {
  141. return self::openAPINullables()[$property] ?? false;
  142. }
  143. /**
  144. * Checks if a nullable property is set to null.
  145. *
  146. * @param string $property
  147. * @return bool
  148. */
  149. public function isNullableSetToNull(string $property): bool
  150. {
  151. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  152. }
  153. /**
  154. * Array of attributes where the key is the local name,
  155. * and the value is the original name
  156. *
  157. * @var string[]
  158. */
  159. protected static $attributeMap = [
  160. 'id' => 'id',
  161. 'email' => 'email',
  162. 'status' => 'status',
  163. 'created_at' => 'created_at'
  164. ];
  165. /**
  166. * Array of attributes to setter functions (for deserialization of responses)
  167. *
  168. * @var string[]
  169. */
  170. protected static $setters = [
  171. 'id' => 'setId',
  172. 'email' => 'setEmail',
  173. 'status' => 'setStatus',
  174. 'created_at' => 'setCreatedAt'
  175. ];
  176. /**
  177. * Array of attributes to getter functions (for serialization of requests)
  178. *
  179. * @var string[]
  180. */
  181. protected static $getters = [
  182. 'id' => 'getId',
  183. 'email' => 'getEmail',
  184. 'status' => 'getStatus',
  185. 'created_at' => 'getCreatedAt'
  186. ];
  187. /**
  188. * Array of attributes where the key is the local name,
  189. * and the value is the original name
  190. *
  191. * @return array
  192. */
  193. public static function attributeMap()
  194. {
  195. return self::$attributeMap;
  196. }
  197. /**
  198. * Array of attributes to setter functions (for deserialization of responses)
  199. *
  200. * @return array
  201. */
  202. public static function setters()
  203. {
  204. return self::$setters;
  205. }
  206. /**
  207. * Array of attributes to getter functions (for serialization of requests)
  208. *
  209. * @return array
  210. */
  211. public static function getters()
  212. {
  213. return self::$getters;
  214. }
  215. /**
  216. * The original name of the model.
  217. *
  218. * @return string
  219. */
  220. public function getModelName()
  221. {
  222. return self::$openAPIModelName;
  223. }
  224. /**
  225. * Associative array for storing property values
  226. *
  227. * @var mixed[]
  228. */
  229. protected $container = [];
  230. /**
  231. * Constructor
  232. *
  233. * @param mixed[]|null $data Associated array of property values
  234. * initializing the model
  235. */
  236. public function __construct(?array $data = null)
  237. {
  238. $this->setIfExists('id', $data ?? [], null);
  239. $this->setIfExists('email', $data ?? [], null);
  240. $this->setIfExists('status', $data ?? [], null);
  241. $this->setIfExists('created_at', $data ?? [], null);
  242. }
  243. /**
  244. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  245. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  246. * $this->openAPINullablesSetToNull array
  247. *
  248. * @param string $variableName
  249. * @param array $fields
  250. * @param mixed $defaultValue
  251. */
  252. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  253. {
  254. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  255. $this->openAPINullablesSetToNull[] = $variableName;
  256. }
  257. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  258. }
  259. /**
  260. * Show all the invalid properties with reasons.
  261. *
  262. * @return array invalid properties with reasons
  263. */
  264. public function listInvalidProperties()
  265. {
  266. $invalidProperties = [];
  267. return $invalidProperties;
  268. }
  269. /**
  270. * Validate all the properties in the model
  271. * return true if all passed
  272. *
  273. * @return bool True if all properties are valid
  274. */
  275. public function valid()
  276. {
  277. return count($this->listInvalidProperties()) === 0;
  278. }
  279. /**
  280. * Gets id
  281. *
  282. * @return string|null
  283. */
  284. public function getId()
  285. {
  286. return $this->container['id'];
  287. }
  288. /**
  289. * Sets id
  290. *
  291. * @param string|null $id id
  292. *
  293. * @return self
  294. */
  295. public function setId($id)
  296. {
  297. if (is_null($id)) {
  298. throw new \InvalidArgumentException('non-nullable id cannot be null');
  299. }
  300. $this->container['id'] = $id;
  301. return $this;
  302. }
  303. /**
  304. * Gets email
  305. *
  306. * @return string|null
  307. */
  308. public function getEmail()
  309. {
  310. return $this->container['email'];
  311. }
  312. /**
  313. * Sets email
  314. *
  315. * @param string|null $email email
  316. *
  317. * @return self
  318. */
  319. public function setEmail($email)
  320. {
  321. if (is_null($email)) {
  322. throw new \InvalidArgumentException('non-nullable email cannot be null');
  323. }
  324. $this->container['email'] = $email;
  325. return $this;
  326. }
  327. /**
  328. * Gets status
  329. *
  330. * @return string|null
  331. */
  332. public function getStatus()
  333. {
  334. return $this->container['status'];
  335. }
  336. /**
  337. * Sets status
  338. *
  339. * @param string|null $status status
  340. *
  341. * @return self
  342. */
  343. public function setStatus($status)
  344. {
  345. if (is_null($status)) {
  346. throw new \InvalidArgumentException('non-nullable status cannot be null');
  347. }
  348. $this->container['status'] = $status;
  349. return $this;
  350. }
  351. /**
  352. * Gets created_at
  353. *
  354. * @return string|null
  355. */
  356. public function getCreatedAt()
  357. {
  358. return $this->container['created_at'];
  359. }
  360. /**
  361. * Sets created_at
  362. *
  363. * @param string|null $created_at created_at
  364. *
  365. * @return self
  366. */
  367. public function setCreatedAt($created_at)
  368. {
  369. if (is_null($created_at)) {
  370. array_push($this->openAPINullablesSetToNull, 'created_at');
  371. } else {
  372. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  373. $index = array_search('created_at', $nullablesSetToNull);
  374. if ($index !== FALSE) {
  375. unset($nullablesSetToNull[$index]);
  376. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  377. }
  378. }
  379. $this->container['created_at'] = $created_at;
  380. return $this;
  381. }
  382. /**
  383. * Returns true if offset exists. False otherwise.
  384. *
  385. * @param integer|string $offset Offset
  386. *
  387. * @return boolean
  388. */
  389. public function offsetExists(mixed $offset): bool
  390. {
  391. return isset($this->container[$offset]);
  392. }
  393. /**
  394. * Gets offset.
  395. *
  396. * @param integer|string $offset Offset
  397. *
  398. * @return mixed|null
  399. */
  400. #[\ReturnTypeWillChange]
  401. public function offsetGet(mixed $offset)
  402. {
  403. return $this->container[$offset] ?? null;
  404. }
  405. /**
  406. * Sets value based on offset.
  407. *
  408. * @param int|null $offset Offset
  409. * @param mixed $value Value to be set
  410. *
  411. * @return void
  412. */
  413. public function offsetSet($offset, $value): void
  414. {
  415. if (is_null($offset)) {
  416. $this->container[] = $value;
  417. } else {
  418. $this->container[$offset] = $value;
  419. }
  420. }
  421. /**
  422. * Unsets offset.
  423. *
  424. * @param integer|string $offset Offset
  425. *
  426. * @return void
  427. */
  428. public function offsetUnset(mixed $offset): void
  429. {
  430. unset($this->container[$offset]);
  431. }
  432. /**
  433. * Serializes the object to a value that can be serialized natively by json_encode().
  434. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  435. *
  436. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  437. * of any type other than a resource.
  438. */
  439. #[\ReturnTypeWillChange]
  440. public function jsonSerialize()
  441. {
  442. return ObjectSerializer::sanitizeForSerialization($this);
  443. }
  444. /**
  445. * Gets the string presentation of the object
  446. *
  447. * @return string
  448. */
  449. public function __toString()
  450. {
  451. return json_encode(
  452. ObjectSerializer::sanitizeForSerialization($this),
  453. JSON_PRETTY_PRINT
  454. );
  455. }
  456. /**
  457. * Gets a header-safe presentation of the object
  458. *
  459. * @return string
  460. */
  461. public function toHeaderValue()
  462. {
  463. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  464. }
  465. }