1111use CasParser \Core \Contracts \BaseModel ;
1212
1313/**
14+ * An object containing the method's parameters.
15+ * Example usage:
16+ * ```
17+ * $params = (new CasGeneratorGenerateCasParams); // set properties as needed
18+ * $client->casGenerator->generateCas(...$params->toArray());
19+ * ```
1420 * This endpoint generates CAS (Consolidated Account Statement) documents by submitting a mailback request to the specified CAS authority.
1521 * Currently only supports KFintech, with plans to support CAMS, CDSL, and NSDL in the future.
1622 *
23+ * @method toArray()
24+ * Returns the parameters as an associative array suitable for passing to the client method.
25+ *
26+ * `$client->casGenerator->generateCas(...$params->toArray());`
27+ *
1728 * @see CasParser\CasGenerator->generateCas
1829 *
1930 * @phpstan-type cas_generator_generate_cas_params = array{
2031 * email: string,
2132 * fromDate: string,
2233 * password: string,
2334 * toDate: string,
24- * casAuthority?: CasAuthority::* ,
35+ * casAuthority?: CasAuthority|value-of<CasAuthority> ,
2536 * panNo?: string,
2637 * }
2738 */
@@ -58,7 +69,7 @@ final class CasGeneratorGenerateCasParams implements BaseModel
5869 /**
5970 * CAS authority to generate the document from (currently only kfintech is supported).
6071 *
61- * @var CasAuthority::* |null $casAuthority
72+ * @var value-of< CasAuthority> |null $casAuthority
6273 */
6374 #[Api('cas_authority ' , enum: CasAuthority::class, optional: true )]
6475 public ?string $ casAuthority ;
@@ -99,14 +110,14 @@ public function __construct()
99110 *
100111 * You must use named parameters to construct any parameters with a default value.
101112 *
102- * @param CasAuthority::* $casAuthority
113+ * @param CasAuthority|value-of<CasAuthority> $casAuthority
103114 */
104115 public static function with (
105116 string $ email ,
106117 string $ fromDate ,
107118 string $ password ,
108119 string $ toDate ,
109- ? string $ casAuthority = null ,
120+ CasAuthority | string | null $ casAuthority = null ,
110121 ?string $ panNo = null ,
111122 ): self {
112123 $ obj = new self ;
@@ -116,7 +127,7 @@ public static function with(
116127 $ obj ->password = $ password ;
117128 $ obj ->toDate = $ toDate ;
118129
119- null !== $ casAuthority && $ obj ->casAuthority = $ casAuthority ;
130+ null !== $ casAuthority && $ obj ->casAuthority = $ casAuthority instanceof CasAuthority ? $ casAuthority -> value : $ casAuthority ;
120131 null !== $ panNo && $ obj ->panNo = $ panNo ;
121132
122133 return $ obj ;
@@ -169,12 +180,12 @@ public function withToDate(string $toDate): self
169180 /**
170181 * CAS authority to generate the document from (currently only kfintech is supported).
171182 *
172- * @param CasAuthority::* $casAuthority
183+ * @param CasAuthority|value-of<CasAuthority> $casAuthority
173184 */
174- public function withCasAuthority (string $ casAuthority ): self
185+ public function withCasAuthority (CasAuthority | string $ casAuthority ): self
175186 {
176187 $ obj = clone $ this ;
177- $ obj ->casAuthority = $ casAuthority ;
188+ $ obj ->casAuthority = $ casAuthority instanceof CasAuthority ? $ casAuthority -> value : $ casAuthority ;
178189
179190 return $ obj ;
180191 }
0 commit comments