GetApiV3AdminAgentStats200ResponseDataDailyInner.php 19 KB

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