GetApiV3Groups200ResponseDataInner.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. <?php
  2. /**
  3. * GetApiV3Groups200ResponseDataInner
  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: 1.0.0
  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. * GetApiV3Groups200ResponseDataInner 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 GetApiV3Groups200ResponseDataInner 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_groups_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. 'name' => 'string',
  55. 'description' => 'string',
  56. 'status' => 'int',
  57. 'owner' => '\WikipaliApi\Model\GetApiV3AdminAgentRuns200ResponseDataInnerUser',
  58. 'role' => 'string',
  59. 'created_at' => 'string',
  60. 'updated_at' => 'string'
  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. 'name' => null,
  72. 'description' => null,
  73. 'status' => null,
  74. 'owner' => null,
  75. 'role' => null,
  76. 'created_at' => null,
  77. 'updated_at' => 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. 'name' => false,
  87. 'description' => true,
  88. 'status' => false,
  89. 'owner' => true,
  90. 'role' => true,
  91. 'created_at' => false,
  92. 'updated_at' => false
  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. 'name' => 'name',
  174. 'description' => 'description',
  175. 'status' => 'status',
  176. 'owner' => 'owner',
  177. 'role' => 'role',
  178. 'created_at' => 'created_at',
  179. 'updated_at' => 'updated_at'
  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. 'name' => 'setName',
  189. 'description' => 'setDescription',
  190. 'status' => 'setStatus',
  191. 'owner' => 'setOwner',
  192. 'role' => 'setRole',
  193. 'created_at' => 'setCreatedAt',
  194. 'updated_at' => 'setUpdatedAt'
  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. 'name' => 'getName',
  204. 'description' => 'getDescription',
  205. 'status' => 'getStatus',
  206. 'owner' => 'getOwner',
  207. 'role' => 'getRole',
  208. 'created_at' => 'getCreatedAt',
  209. 'updated_at' => 'getUpdatedAt'
  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('name', $data ?? [], null);
  264. $this->setIfExists('description', $data ?? [], null);
  265. $this->setIfExists('status', $data ?? [], null);
  266. $this->setIfExists('owner', $data ?? [], null);
  267. $this->setIfExists('role', $data ?? [], null);
  268. $this->setIfExists('created_at', $data ?? [], null);
  269. $this->setIfExists('updated_at', $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 name
  333. *
  334. * @return string|null
  335. */
  336. public function getName()
  337. {
  338. return $this->container['name'];
  339. }
  340. /**
  341. * Sets name
  342. *
  343. * @param string|null $name name
  344. *
  345. * @return self
  346. */
  347. public function setName($name)
  348. {
  349. if (is_null($name)) {
  350. throw new \InvalidArgumentException('non-nullable name cannot be null');
  351. }
  352. $this->container['name'] = $name;
  353. return $this;
  354. }
  355. /**
  356. * Gets description
  357. *
  358. * @return string|null
  359. */
  360. public function getDescription()
  361. {
  362. return $this->container['description'];
  363. }
  364. /**
  365. * Sets description
  366. *
  367. * @param string|null $description description
  368. *
  369. * @return self
  370. */
  371. public function setDescription($description)
  372. {
  373. if (is_null($description)) {
  374. array_push($this->openAPINullablesSetToNull, 'description');
  375. } else {
  376. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  377. $index = array_search('description', $nullablesSetToNull);
  378. if ($index !== FALSE) {
  379. unset($nullablesSetToNull[$index]);
  380. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  381. }
  382. }
  383. $this->container['description'] = $description;
  384. return $this;
  385. }
  386. /**
  387. * Gets status
  388. *
  389. * @return int|null
  390. */
  391. public function getStatus()
  392. {
  393. return $this->container['status'];
  394. }
  395. /**
  396. * Sets status
  397. *
  398. * @param int|null $status status
  399. *
  400. * @return self
  401. */
  402. public function setStatus($status)
  403. {
  404. if (is_null($status)) {
  405. throw new \InvalidArgumentException('non-nullable status cannot be null');
  406. }
  407. $this->container['status'] = $status;
  408. return $this;
  409. }
  410. /**
  411. * Gets owner
  412. *
  413. * @return \WikipaliApi\Model\GetApiV3AdminAgentRuns200ResponseDataInnerUser|null
  414. */
  415. public function getOwner()
  416. {
  417. return $this->container['owner'];
  418. }
  419. /**
  420. * Sets owner
  421. *
  422. * @param \WikipaliApi\Model\GetApiV3AdminAgentRuns200ResponseDataInnerUser|null $owner owner
  423. *
  424. * @return self
  425. */
  426. public function setOwner($owner)
  427. {
  428. if (is_null($owner)) {
  429. array_push($this->openAPINullablesSetToNull, 'owner');
  430. } else {
  431. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  432. $index = array_search('owner', $nullablesSetToNull);
  433. if ($index !== FALSE) {
  434. unset($nullablesSetToNull[$index]);
  435. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  436. }
  437. }
  438. $this->container['owner'] = $owner;
  439. return $this;
  440. }
  441. /**
  442. * Gets role
  443. *
  444. * @return string|null
  445. */
  446. public function getRole()
  447. {
  448. return $this->container['role'];
  449. }
  450. /**
  451. * Sets role
  452. *
  453. * @param string|null $role 仅在部分查询口径下返回。
  454. *
  455. * @return self
  456. */
  457. public function setRole($role)
  458. {
  459. if (is_null($role)) {
  460. array_push($this->openAPINullablesSetToNull, 'role');
  461. } else {
  462. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  463. $index = array_search('role', $nullablesSetToNull);
  464. if ($index !== FALSE) {
  465. unset($nullablesSetToNull[$index]);
  466. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  467. }
  468. }
  469. $this->container['role'] = $role;
  470. return $this;
  471. }
  472. /**
  473. * Gets created_at
  474. *
  475. * @return string|null
  476. */
  477. public function getCreatedAt()
  478. {
  479. return $this->container['created_at'];
  480. }
  481. /**
  482. * Sets created_at
  483. *
  484. * @param string|null $created_at created_at
  485. *
  486. * @return self
  487. */
  488. public function setCreatedAt($created_at)
  489. {
  490. if (is_null($created_at)) {
  491. throw new \InvalidArgumentException('non-nullable created_at cannot be null');
  492. }
  493. $this->container['created_at'] = $created_at;
  494. return $this;
  495. }
  496. /**
  497. * Gets updated_at
  498. *
  499. * @return string|null
  500. */
  501. public function getUpdatedAt()
  502. {
  503. return $this->container['updated_at'];
  504. }
  505. /**
  506. * Sets updated_at
  507. *
  508. * @param string|null $updated_at updated_at
  509. *
  510. * @return self
  511. */
  512. public function setUpdatedAt($updated_at)
  513. {
  514. if (is_null($updated_at)) {
  515. throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
  516. }
  517. $this->container['updated_at'] = $updated_at;
  518. return $this;
  519. }
  520. /**
  521. * Returns true if offset exists. False otherwise.
  522. *
  523. * @param integer|string $offset Offset
  524. *
  525. * @return boolean
  526. */
  527. public function offsetExists(mixed $offset): bool
  528. {
  529. return isset($this->container[$offset]);
  530. }
  531. /**
  532. * Gets offset.
  533. *
  534. * @param integer|string $offset Offset
  535. *
  536. * @return mixed|null
  537. */
  538. #[\ReturnTypeWillChange]
  539. public function offsetGet(mixed $offset)
  540. {
  541. return $this->container[$offset] ?? null;
  542. }
  543. /**
  544. * Sets value based on offset.
  545. *
  546. * @param int|null $offset Offset
  547. * @param mixed $value Value to be set
  548. *
  549. * @return void
  550. */
  551. public function offsetSet($offset, $value): void
  552. {
  553. if (is_null($offset)) {
  554. $this->container[] = $value;
  555. } else {
  556. $this->container[$offset] = $value;
  557. }
  558. }
  559. /**
  560. * Unsets offset.
  561. *
  562. * @param integer|string $offset Offset
  563. *
  564. * @return void
  565. */
  566. public function offsetUnset(mixed $offset): void
  567. {
  568. unset($this->container[$offset]);
  569. }
  570. /**
  571. * Serializes the object to a value that can be serialized natively by json_encode().
  572. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  573. *
  574. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  575. * of any type other than a resource.
  576. */
  577. #[\ReturnTypeWillChange]
  578. public function jsonSerialize()
  579. {
  580. return ObjectSerializer::sanitizeForSerialization($this);
  581. }
  582. /**
  583. * Gets the string presentation of the object
  584. *
  585. * @return string
  586. */
  587. public function __toString()
  588. {
  589. return json_encode(
  590. ObjectSerializer::sanitizeForSerialization($this),
  591. JSON_PRETTY_PRINT
  592. );
  593. }
  594. /**
  595. * Gets a header-safe presentation of the object
  596. *
  597. * @return string
  598. */
  599. public function toHeaderValue()
  600. {
  601. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  602. }
  603. }