GetApiV3AgentQuota200ResponseData.php 18 KB

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