PostApiV3AdminCreditSettlements200ResponseData.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  1. <?php
  2. /**
  3. * PostApiV3AdminCreditSettlements200ResponseData
  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. * PostApiV3AdminCreditSettlements200ResponseData 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 PostApiV3AdminCreditSettlements200ResponseData 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_admin_credit_settlements_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. 'mode' => 'string',
  54. 'from' => 'string',
  55. 'to' => 'string',
  56. 'users' => 'int',
  57. 'pairs' => 'int',
  58. 'trigger' => 'string',
  59. 'operator' => 'string',
  60. 'ran_at' => 'string',
  61. 'seconds' => 'float'
  62. ];
  63. /**
  64. * Array of property to format mappings. Used for (de)serialization
  65. *
  66. * @var string[]
  67. * @phpstan-var array<string, string|null>
  68. * @psalm-var array<string, string|null>
  69. */
  70. protected static $openAPIFormats = [
  71. 'mode' => null,
  72. 'from' => null,
  73. 'to' => null,
  74. 'users' => null,
  75. 'pairs' => null,
  76. 'trigger' => null,
  77. 'operator' => null,
  78. 'ran_at' => null,
  79. 'seconds' => null
  80. ];
  81. /**
  82. * Array of nullable properties. Used for (de)serialization
  83. *
  84. * @var boolean[]
  85. */
  86. protected static array $openAPINullables = [
  87. 'mode' => false,
  88. 'from' => false,
  89. 'to' => false,
  90. 'users' => false,
  91. 'pairs' => true,
  92. 'trigger' => false,
  93. 'operator' => true,
  94. 'ran_at' => false,
  95. 'seconds' => false
  96. ];
  97. /**
  98. * If a nullable field gets set to null, insert it here
  99. *
  100. * @var boolean[]
  101. */
  102. protected array $openAPINullablesSetToNull = [];
  103. /**
  104. * Array of property to type mappings. Used for (de)serialization
  105. *
  106. * @return array
  107. */
  108. public static function openAPITypes()
  109. {
  110. return self::$openAPITypes;
  111. }
  112. /**
  113. * Array of property to format mappings. Used for (de)serialization
  114. *
  115. * @return array
  116. */
  117. public static function openAPIFormats()
  118. {
  119. return self::$openAPIFormats;
  120. }
  121. /**
  122. * Array of nullable properties
  123. *
  124. * @return array
  125. */
  126. protected static function openAPINullables(): array
  127. {
  128. return self::$openAPINullables;
  129. }
  130. /**
  131. * Array of nullable field names deliberately set to null
  132. *
  133. * @return boolean[]
  134. */
  135. private function getOpenAPINullablesSetToNull(): array
  136. {
  137. return $this->openAPINullablesSetToNull;
  138. }
  139. /**
  140. * Setter - Array of nullable field names deliberately set to null
  141. *
  142. * @param boolean[] $openAPINullablesSetToNull
  143. */
  144. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  145. {
  146. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  147. }
  148. /**
  149. * Checks if a property is nullable
  150. *
  151. * @param string $property
  152. * @return bool
  153. */
  154. public static function isNullable(string $property): bool
  155. {
  156. return self::openAPINullables()[$property] ?? false;
  157. }
  158. /**
  159. * Checks if a nullable property is set to null.
  160. *
  161. * @param string $property
  162. * @return bool
  163. */
  164. public function isNullableSetToNull(string $property): bool
  165. {
  166. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  167. }
  168. /**
  169. * Array of attributes where the key is the local name,
  170. * and the value is the original name
  171. *
  172. * @var string[]
  173. */
  174. protected static $attributeMap = [
  175. 'mode' => 'mode',
  176. 'from' => 'from',
  177. 'to' => 'to',
  178. 'users' => 'users',
  179. 'pairs' => 'pairs',
  180. 'trigger' => 'trigger',
  181. 'operator' => 'operator',
  182. 'ran_at' => 'ran_at',
  183. 'seconds' => 'seconds'
  184. ];
  185. /**
  186. * Array of attributes to setter functions (for deserialization of responses)
  187. *
  188. * @var string[]
  189. */
  190. protected static $setters = [
  191. 'mode' => 'setMode',
  192. 'from' => 'setFrom',
  193. 'to' => 'setTo',
  194. 'users' => 'setUsers',
  195. 'pairs' => 'setPairs',
  196. 'trigger' => 'setTrigger',
  197. 'operator' => 'setOperator',
  198. 'ran_at' => 'setRanAt',
  199. 'seconds' => 'setSeconds'
  200. ];
  201. /**
  202. * Array of attributes to getter functions (for serialization of requests)
  203. *
  204. * @var string[]
  205. */
  206. protected static $getters = [
  207. 'mode' => 'getMode',
  208. 'from' => 'getFrom',
  209. 'to' => 'getTo',
  210. 'users' => 'getUsers',
  211. 'pairs' => 'getPairs',
  212. 'trigger' => 'getTrigger',
  213. 'operator' => 'getOperator',
  214. 'ran_at' => 'getRanAt',
  215. 'seconds' => 'getSeconds'
  216. ];
  217. /**
  218. * Array of attributes where the key is the local name,
  219. * and the value is the original name
  220. *
  221. * @return array
  222. */
  223. public static function attributeMap()
  224. {
  225. return self::$attributeMap;
  226. }
  227. /**
  228. * Array of attributes to setter functions (for deserialization of responses)
  229. *
  230. * @return array
  231. */
  232. public static function setters()
  233. {
  234. return self::$setters;
  235. }
  236. /**
  237. * Array of attributes to getter functions (for serialization of requests)
  238. *
  239. * @return array
  240. */
  241. public static function getters()
  242. {
  243. return self::$getters;
  244. }
  245. /**
  246. * The original name of the model.
  247. *
  248. * @return string
  249. */
  250. public function getModelName()
  251. {
  252. return self::$openAPIModelName;
  253. }
  254. public const MODE_DAY = 'day';
  255. public const MODE_MISSING = 'missing';
  256. public const TRIGGER_CLI = 'cli';
  257. public const TRIGGER_ADMIN = 'admin';
  258. /**
  259. * Gets allowable values of the enum
  260. *
  261. * @return string[]
  262. */
  263. public function getModeAllowableValues()
  264. {
  265. return [
  266. self::MODE_DAY,
  267. self::MODE_MISSING,
  268. ];
  269. }
  270. /**
  271. * Gets allowable values of the enum
  272. *
  273. * @return string[]
  274. */
  275. public function getTriggerAllowableValues()
  276. {
  277. return [
  278. self::TRIGGER_CLI,
  279. self::TRIGGER_ADMIN,
  280. ];
  281. }
  282. /**
  283. * Associative array for storing property values
  284. *
  285. * @var mixed[]
  286. */
  287. protected $container = [];
  288. /**
  289. * Constructor
  290. *
  291. * @param mixed[]|null $data Associated array of property values
  292. * initializing the model
  293. */
  294. public function __construct(?array $data = null)
  295. {
  296. $this->setIfExists('mode', $data ?? [], null);
  297. $this->setIfExists('from', $data ?? [], null);
  298. $this->setIfExists('to', $data ?? [], null);
  299. $this->setIfExists('users', $data ?? [], null);
  300. $this->setIfExists('pairs', $data ?? [], null);
  301. $this->setIfExists('trigger', $data ?? [], null);
  302. $this->setIfExists('operator', $data ?? [], null);
  303. $this->setIfExists('ran_at', $data ?? [], null);
  304. $this->setIfExists('seconds', $data ?? [], null);
  305. }
  306. /**
  307. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  308. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  309. * $this->openAPINullablesSetToNull array
  310. *
  311. * @param string $variableName
  312. * @param array $fields
  313. * @param mixed $defaultValue
  314. */
  315. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  316. {
  317. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  318. $this->openAPINullablesSetToNull[] = $variableName;
  319. }
  320. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  321. }
  322. /**
  323. * Show all the invalid properties with reasons.
  324. *
  325. * @return array invalid properties with reasons
  326. */
  327. public function listInvalidProperties()
  328. {
  329. $invalidProperties = [];
  330. $allowedValues = $this->getModeAllowableValues();
  331. if (!is_null($this->container['mode']) && !in_array($this->container['mode'], $allowedValues, true)) {
  332. $invalidProperties[] = sprintf(
  333. "invalid value '%s' for 'mode', must be one of '%s'",
  334. $this->container['mode'],
  335. implode("', '", $allowedValues)
  336. );
  337. }
  338. $allowedValues = $this->getTriggerAllowableValues();
  339. if (!is_null($this->container['trigger']) && !in_array($this->container['trigger'], $allowedValues, true)) {
  340. $invalidProperties[] = sprintf(
  341. "invalid value '%s' for 'trigger', must be one of '%s'",
  342. $this->container['trigger'],
  343. implode("', '", $allowedValues)
  344. );
  345. }
  346. return $invalidProperties;
  347. }
  348. /**
  349. * Validate all the properties in the model
  350. * return true if all passed
  351. *
  352. * @return bool True if all properties are valid
  353. */
  354. public function valid()
  355. {
  356. return count($this->listInvalidProperties()) === 0;
  357. }
  358. /**
  359. * Gets mode
  360. *
  361. * @return string|null
  362. */
  363. public function getMode()
  364. {
  365. return $this->container['mode'];
  366. }
  367. /**
  368. * Sets mode
  369. *
  370. * @param string|null $mode mode
  371. *
  372. * @return self
  373. */
  374. public function setMode($mode)
  375. {
  376. if (is_null($mode)) {
  377. throw new \InvalidArgumentException('non-nullable mode cannot be null');
  378. }
  379. $allowedValues = $this->getModeAllowableValues();
  380. if (!in_array($mode, $allowedValues, true)) {
  381. throw new \InvalidArgumentException(
  382. sprintf(
  383. "Invalid value '%s' for 'mode', must be one of '%s'",
  384. $mode,
  385. implode("', '", $allowedValues)
  386. )
  387. );
  388. }
  389. $this->container['mode'] = $mode;
  390. return $this;
  391. }
  392. /**
  393. * Gets from
  394. *
  395. * @return string|null
  396. */
  397. public function getFrom()
  398. {
  399. return $this->container['from'];
  400. }
  401. /**
  402. * Sets from
  403. *
  404. * @param string|null $from from
  405. *
  406. * @return self
  407. */
  408. public function setFrom($from)
  409. {
  410. if (is_null($from)) {
  411. throw new \InvalidArgumentException('non-nullable from cannot be null');
  412. }
  413. $this->container['from'] = $from;
  414. return $this;
  415. }
  416. /**
  417. * Gets to
  418. *
  419. * @return string|null
  420. */
  421. public function getTo()
  422. {
  423. return $this->container['to'];
  424. }
  425. /**
  426. * Sets to
  427. *
  428. * @param string|null $to to
  429. *
  430. * @return self
  431. */
  432. public function setTo($to)
  433. {
  434. if (is_null($to)) {
  435. throw new \InvalidArgumentException('non-nullable to cannot be null');
  436. }
  437. $this->container['to'] = $to;
  438. return $this;
  439. }
  440. /**
  441. * Gets users
  442. *
  443. * @return int|null
  444. */
  445. public function getUsers()
  446. {
  447. return $this->container['users'];
  448. }
  449. /**
  450. * Sets users
  451. *
  452. * @param int|null $users users
  453. *
  454. * @return self
  455. */
  456. public function setUsers($users)
  457. {
  458. if (is_null($users)) {
  459. throw new \InvalidArgumentException('non-nullable users cannot be null');
  460. }
  461. $this->container['users'] = $users;
  462. return $this;
  463. }
  464. /**
  465. * Gets pairs
  466. *
  467. * @return int|null
  468. */
  469. public function getPairs()
  470. {
  471. return $this->container['pairs'];
  472. }
  473. /**
  474. * Sets pairs
  475. *
  476. * @param int|null $pairs pairs
  477. *
  478. * @return self
  479. */
  480. public function setPairs($pairs)
  481. {
  482. if (is_null($pairs)) {
  483. array_push($this->openAPINullablesSetToNull, 'pairs');
  484. } else {
  485. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  486. $index = array_search('pairs', $nullablesSetToNull);
  487. if ($index !== FALSE) {
  488. unset($nullablesSetToNull[$index]);
  489. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  490. }
  491. }
  492. $this->container['pairs'] = $pairs;
  493. return $this;
  494. }
  495. /**
  496. * Gets trigger
  497. *
  498. * @return string|null
  499. */
  500. public function getTrigger()
  501. {
  502. return $this->container['trigger'];
  503. }
  504. /**
  505. * Sets trigger
  506. *
  507. * @param string|null $trigger trigger
  508. *
  509. * @return self
  510. */
  511. public function setTrigger($trigger)
  512. {
  513. if (is_null($trigger)) {
  514. throw new \InvalidArgumentException('non-nullable trigger cannot be null');
  515. }
  516. $allowedValues = $this->getTriggerAllowableValues();
  517. if (!in_array($trigger, $allowedValues, true)) {
  518. throw new \InvalidArgumentException(
  519. sprintf(
  520. "Invalid value '%s' for 'trigger', must be one of '%s'",
  521. $trigger,
  522. implode("', '", $allowedValues)
  523. )
  524. );
  525. }
  526. $this->container['trigger'] = $trigger;
  527. return $this;
  528. }
  529. /**
  530. * Gets operator
  531. *
  532. * @return string|null
  533. */
  534. public function getOperator()
  535. {
  536. return $this->container['operator'];
  537. }
  538. /**
  539. * Sets operator
  540. *
  541. * @param string|null $operator operator
  542. *
  543. * @return self
  544. */
  545. public function setOperator($operator)
  546. {
  547. if (is_null($operator)) {
  548. array_push($this->openAPINullablesSetToNull, 'operator');
  549. } else {
  550. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  551. $index = array_search('operator', $nullablesSetToNull);
  552. if ($index !== FALSE) {
  553. unset($nullablesSetToNull[$index]);
  554. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  555. }
  556. }
  557. $this->container['operator'] = $operator;
  558. return $this;
  559. }
  560. /**
  561. * Gets ran_at
  562. *
  563. * @return string|null
  564. */
  565. public function getRanAt()
  566. {
  567. return $this->container['ran_at'];
  568. }
  569. /**
  570. * Sets ran_at
  571. *
  572. * @param string|null $ran_at ran_at
  573. *
  574. * @return self
  575. */
  576. public function setRanAt($ran_at)
  577. {
  578. if (is_null($ran_at)) {
  579. throw new \InvalidArgumentException('non-nullable ran_at cannot be null');
  580. }
  581. $this->container['ran_at'] = $ran_at;
  582. return $this;
  583. }
  584. /**
  585. * Gets seconds
  586. *
  587. * @return float|null
  588. */
  589. public function getSeconds()
  590. {
  591. return $this->container['seconds'];
  592. }
  593. /**
  594. * Sets seconds
  595. *
  596. * @param float|null $seconds seconds
  597. *
  598. * @return self
  599. */
  600. public function setSeconds($seconds)
  601. {
  602. if (is_null($seconds)) {
  603. throw new \InvalidArgumentException('non-nullable seconds cannot be null');
  604. }
  605. $this->container['seconds'] = $seconds;
  606. return $this;
  607. }
  608. /**
  609. * Returns true if offset exists. False otherwise.
  610. *
  611. * @param integer|string $offset Offset
  612. *
  613. * @return boolean
  614. */
  615. public function offsetExists(mixed $offset): bool
  616. {
  617. return isset($this->container[$offset]);
  618. }
  619. /**
  620. * Gets offset.
  621. *
  622. * @param integer|string $offset Offset
  623. *
  624. * @return mixed|null
  625. */
  626. #[\ReturnTypeWillChange]
  627. public function offsetGet(mixed $offset)
  628. {
  629. return $this->container[$offset] ?? null;
  630. }
  631. /**
  632. * Sets value based on offset.
  633. *
  634. * @param int|null $offset Offset
  635. * @param mixed $value Value to be set
  636. *
  637. * @return void
  638. */
  639. public function offsetSet($offset, $value): void
  640. {
  641. if (is_null($offset)) {
  642. $this->container[] = $value;
  643. } else {
  644. $this->container[$offset] = $value;
  645. }
  646. }
  647. /**
  648. * Unsets offset.
  649. *
  650. * @param integer|string $offset Offset
  651. *
  652. * @return void
  653. */
  654. public function offsetUnset(mixed $offset): void
  655. {
  656. unset($this->container[$offset]);
  657. }
  658. /**
  659. * Serializes the object to a value that can be serialized natively by json_encode().
  660. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  661. *
  662. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  663. * of any type other than a resource.
  664. */
  665. #[\ReturnTypeWillChange]
  666. public function jsonSerialize()
  667. {
  668. return ObjectSerializer::sanitizeForSerialization($this);
  669. }
  670. /**
  671. * Gets the string presentation of the object
  672. *
  673. * @return string
  674. */
  675. public function __toString()
  676. {
  677. return json_encode(
  678. ObjectSerializer::sanitizeForSerialization($this),
  679. JSON_PRETTY_PRINT
  680. );
  681. }
  682. /**
  683. * Gets a header-safe presentation of the object
  684. *
  685. * @return string
  686. */
  687. public function toHeaderValue()
  688. {
  689. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  690. }
  691. }