scrapebadger 0.2.0

Async Rust SDK and CLI for the ScrapeBadger web-scraping API (Amazon, Google, Twitter/X, Reddit, Vinted, Web Scraping).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
// @generated by `cargo run -p xtask -- gen` from specs/google.json — do not edit by hand.
#![allow(clippy::all)]
#![allow(
    dead_code,
    unused_imports,
    unused_variables,
    non_snake_case,
    rustdoc::all
)]

use crate::core::{Client, Error, Method, QueryParams, Result};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;

/// Handle for the `google` platform. Obtain via [`crate::ScrapeBadger::google`].
#[derive(Clone)]
pub struct Google {
    client: Client,
}

impl Google {
    pub(crate) fn new(client: Client) -> Self {
        Self { client }
    }

    /// Access the underlying transport client.
    pub fn client(&self) -> &Client {
        &self.client
    }

    /// Google AI Mode search
    ///
    /// Get AI-generated search results from Google AI Mode.
    ///
    /// **Currently returns HTTP 501.** As of 2026 Google has repurposed
    /// the historical ``udm=50`` parameter — it now opens the Visual Search
    /// history prompt, not a dedicated AI Mode surface. There is no
    /// standalone ``/search?udm=50`` URL that returns AI-only content
    /// anymore; AI Overview blocks are rendered inside regular SERPs
    /// instead, gated on query + user + geolocation signals.
    /// `GET /api/v1/ai-mode/search`
    pub async fn search_ai_mode(&self, params: SearchAiModeParams) -> Result<AiModeResponse> {
        let path = "/api/v1/ai-mode/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Google search suggestions
    ///
    /// Get Google search autocomplete suggestions via the JSON API.
    ///
    /// Returns up to 10 search suggestions ordered by relevance.
    /// `GET /api/v1/autocomplete/`
    pub async fn get_autocomplete(
        &self,
        params: GetAutocompleteParams,
    ) -> Result<AutocompleteResponse> {
        let path = "/api/v1/autocomplete/".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("gl", params.gl.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Get Google Finance stock quote
    ///
    /// Get a stock or index quote from Google Finance.
    /// `GET /api/v1/finance/quote`
    pub async fn get_finance_quote(
        &self,
        params: GetFinanceQuoteParams,
    ) -> Result<FinanceQuoteResponse> {
        let path = "/api/v1/finance/quote".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("hl", params.hl.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Google Flights search
    ///
    /// Search Google Flights for available itineraries.
    ///
    /// Returns `best_flights` (Google's top recommendations) and `other_flights`
    /// (the rest of the result set), plus `price_insights` when Google shows
    /// its typical-price range / high-low-typical indicator.
    ///
    /// Parser is best-effort against the rendered DOM — Google's internal
    /// batchexecute protobuf would give richer data (seat maps, booking tokens,
    /// `GET /api/v1/flights/search`
    pub async fn flights_search(
        &self,
        params: FlightsSearchParams,
    ) -> Result<GoogleFlightsResponse> {
        let path = "/api/v1/flights/search".to_string();
        let mut q = QueryParams::new();
        q.opt("departure_id", params.departure_id.as_ref());
        q.opt("arrival_id", params.arrival_id.as_ref());
        q.opt("outbound_date", params.outbound_date.as_ref());
        q.opt("return_date", params.return_date.as_ref());
        q.opt("trip_type", params.trip_type.as_ref());
        q.opt("adults", params.adults.as_ref());
        q.opt("children", params.children.as_ref());
        q.opt("infants_in_seat", params.infants_in_seat.as_ref());
        q.opt("infants_on_lap", params.infants_on_lap.as_ref());
        q.opt("travel_class", params.travel_class.as_ref());
        q.opt("currency", params.currency.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("stops", params.stops.as_ref());
        q.opt("max_price", params.max_price.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Hotel details
    ///
    /// Get detailed hotel information and pricing.
    /// `GET /api/v1/hotels/details`
    pub async fn hotel_details(&self, params: HotelDetailsParams) -> Result<HotelDetailResponse> {
        let path = "/api/v1/hotels/details".to_string();
        let mut q = QueryParams::new();
        q.opt("property_token", params.property_token.as_ref());
        q.opt("check_in", params.check_in.as_ref());
        q.opt("check_out", params.check_out.as_ref());
        q.opt("adults", params.adults.as_ref());
        q.opt("currency", params.currency.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Search Google Hotels
    ///
    /// Search Google Hotels with dates and pricing.
    ///
    /// Uses browser rendering to access Google Travel Hotels.
    /// `GET /api/v1/hotels/search`
    pub async fn hotels_search(&self, params: HotelsSearchParams) -> Result<HotelsSearchResponse> {
        let path = "/api/v1/hotels/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("check_in", params.check_in.as_ref());
        q.opt("check_out", params.check_out.as_ref());
        q.opt("adults", params.adults.as_ref());
        q.opt("children", params.children.as_ref());
        q.opt("currency", params.currency.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("sort_by", params.sort_by.as_ref());
        q.opt("min_price", params.min_price.as_ref());
        q.opt("max_price", params.max_price.as_ref());
        q.opt("hotel_class", params.hotel_class.as_ref());
        q.opt("next_page_token", params.next_page_token.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Search Google Images
    ///
    /// Search Google Images for visual content.
    /// `GET /api/v1/images/search`
    pub async fn search_images(&self, params: SearchImagesParams) -> Result<ImagesSearchResponse> {
        let path = "/api/v1/images/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("tbs", params.tbs.as_ref());
        q.opt("imgsz", params.imgsz.as_ref());
        q.opt("imgcolor", params.imgcolor.as_ref());
        q.opt("imgtype", params.imgtype.as_ref());
        q.opt("safe", params.safe.as_ref());
        q.opt("page", params.page.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Search Google Jobs
    ///
    /// Search Google Jobs.
    ///
    /// Two data sources are available via ``mode``:
    ///
    /// - ``mode=rpc`` (default) — Google's own Careers SPA RPC. Very fast
    /// (~300 ms), richly structured (title, apply URL, company,
    /// locations, responsibilities, qualifications, posted-at,
    /// experience levels). Scope limited to Google's openings.
    /// `GET /api/v1/jobs/search`
    pub async fn jobs_search(&self, params: JobsSearchParams) -> Result<JobsSearchResponse> {
        let path = "/api/v1/jobs/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("location", params.location.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("country", params.country.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("language", params.language.as_ref());
        q.opt("domain", params.domain.as_ref());
        q.opt("job_type", params.job_type.as_ref());
        q.opt("date_posted", params.date_posted.as_ref());
        q.opt("ltype", params.ltype.as_ref());
        q.opt("chips", params.chips.as_ref());
        q.opt("uds", params.uds.as_ref());
        q.opt("uule", params.uule.as_ref());
        q.opt("lrad", params.lrad.as_ref());
        q.opt("next_page_token", params.next_page_token.as_ref());
        q.opt("mode", params.mode.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Google Lens visual search
    ///
    /// Search Google Lens by image URL for visually similar results.
    /// `GET /api/v1/lens/search`
    pub async fn search_lens(&self, params: SearchLensParams) -> Result<LensSearchResponse> {
        let path = "/api/v1/lens/search".to_string();
        let mut q = QueryParams::new();
        q.opt("url", params.url.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Google Local Pack search
    ///
    /// Return Google Local Pack listings for a query.
    ///
    /// Unlike ``/v1/google/maps/search`` (which targets the Maps Protobuf API and
    /// is keyed by ``data_id``), this endpoint follows the Web SERP ``tbm=lcl``
    /// mode — the same data that populates the "Places" block inside regular
    /// search results. Use it when you care about ranking relative to a SERP
    /// query (e.g. SEO/local-SEO research), not when you need full place
    /// metadata.
    /// `GET /api/v1/local/search`
    pub async fn local_search(&self, params: LocalSearchParams) -> Result<GoogleLocalResponse> {
        let path = "/api/v1/local/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("domain", params.domain.as_ref());
        q.opt("location", params.location.as_ref());
        q.opt("uule", params.uule.as_ref());
        q.opt("num", params.num.as_ref());
        q.opt("start", params.start.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Get place photos
    ///
    /// Get photos for a Google Maps place.
    ///
    /// Photos are extracted from the ``/maps/preview/place`` response
    /// (field ``data[6][37]``). Returns up to 20 photo URLs with
    /// configurable width/height via the Google CDN pattern
    /// ``lh3.googleusercontent.com/gps-cs-s/{id}=w{w}-h{h}-k-no``.
    /// `GET /api/v1/maps/photos`
    pub async fn maps_photos(&self, params: MapsPhotosParams) -> Result<MapsPhotosResponse> {
        let path = "/api/v1/maps/photos".to_string();
        let mut q = QueryParams::new();
        q.opt("data_id", params.data_id.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("gl", params.gl.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Get place details
    ///
    /// Get detailed place information from Google Maps via the protobuf API.
    ///
    /// Requires either ``place_id`` (e.g. ``ChIJN1t_tDeuEmsRUsoyG83frY4``) or
    /// ``data_id`` (e.g. ``0x89c259617ae5b78b:0xe919ce17bb09920e``). The
    /// data_id is available in the ``data_id`` field of ``/maps/search``
    /// results. Returns name, address, rating, review count, phone, website,
    /// GPS coordinates, categories, and up to 20 photo URLs.
    /// `GET /api/v1/maps/place`
    pub async fn maps_place(&self, params: MapsPlaceParams) -> Result<MapsPlaceResponse> {
        let path = "/api/v1/maps/place".to_string();
        let mut q = QueryParams::new();
        q.opt("place_id", params.place_id.as_ref());
        q.opt("data_id", params.data_id.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("gl", params.gl.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Get business posts
    ///
    /// Get Google Business posts / updates for a Maps place.
    ///
    /// **Approach**: searches the Google SERP for the business by ``ludocid``
    /// (derived from the ``data_id``'s low hex part) and parses the knowledge
    /// panel's ``data-attrid="kc:/local:any posts"`` and
    /// ``kc:/local:merchant_description`` sections. This is the same data
    /// surface and other SERP-based scrapers use.
    ///
    /// `GET /api/v1/maps/posts`
    pub async fn maps_posts(&self, params: MapsPostsParams) -> Result<MapsPostsResponse> {
        let path = "/api/v1/maps/posts".to_string();
        let mut q = QueryParams::new();
        q.opt("data_id", params.data_id.as_ref());
        q.opt("place_id", params.place_id.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("gl", params.gl.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Get place reviews
    ///
    /// Get reviews for a Google Maps place via the protobuf API.
    ///
    /// The ``data_id`` is the hex pair from ``/maps/search`` results
    /// (e.g. ``0x89c259617ae5b78b:0xe919ce17bb09920e``). Supports both
    /// offset-based and token-based pagination.
    /// `GET /api/v1/maps/reviews`
    pub async fn maps_reviews(&self, params: MapsReviewsParams) -> Result<MapsReviewsResponse> {
        let path = "/api/v1/maps/reviews".to_string();
        let mut q = QueryParams::new();
        q.opt("data_id", params.data_id.as_ref());
        q.opt("sort_by", params.sort_by.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("next_page_token", params.next_page_token.as_ref());
        q.opt("offset", params.offset.as_ref());
        q.opt("results", params.results.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Search Google Maps places
    ///
    /// Search Google Maps for places.
    ///
    /// Returns place names, ratings, addresses, phone numbers, coordinates,
    /// hours, and service options.
    /// `GET /api/v1/maps/search`
    pub async fn maps_search(&self, params: MapsSearchParams) -> Result<MapsSearchResponse> {
        let path = "/api/v1/maps/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("ll", params.ll.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("start", params.start.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Search Google News
    ///
    /// Search Google News articles via RSS feed.
    /// `GET /api/v1/news/search`
    pub async fn search_news(&self, params: SearchNewsParams) -> Result<NewsSearchResponse> {
        let path = "/api/v1/news/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("max_results", params.max_results.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// News by topic
    ///
    /// Get Google News articles by topic category via RSS.
    /// `GET /api/v1/news/topics`
    pub async fn news_by_topic(&self, params: NewsByTopicParams) -> Result<NewsTopicsResponse> {
        let path = "/api/v1/news/topics".to_string();
        let mut q = QueryParams::new();
        q.opt("topic", params.topic.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("max_results", params.max_results.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Trending news
    ///
    /// Get trending Google News stories via RSS.
    /// `GET /api/v1/news/trending`
    pub async fn trending_news(&self, params: TrendingNewsParams) -> Result<NewsTrendingResponse> {
        let path = "/api/v1/news/trending".to_string();
        let mut q = QueryParams::new();
        q.opt("hl", params.hl.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("max_results", params.max_results.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Get patent details
    ///
    /// Get detailed patent information using the XHR endpoint (returns HTML).
    /// `GET /api/v1/patents/detail`
    pub async fn get_patent_detail(
        &self,
        params: GetPatentDetailParams,
    ) -> Result<PatentDetailResponse> {
        let path = "/api/v1/patents/detail".to_string();
        let mut q = QueryParams::new();
        q.opt("patent_id", params.patent_id.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Search Google Patents
    ///
    /// Search Google Patents using the XHR API.
    /// `GET /api/v1/patents/search`
    pub async fn search_patents(
        &self,
        params: SearchPatentsParams,
    ) -> Result<PatentSearchResponse> {
        let path = "/api/v1/patents/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("page", params.page.as_ref());
        q.opt("num", params.num.as_ref());
        q.opt("sort", params.sort.as_ref());
        q.opt("inventor", params.inventor.as_ref());
        q.opt("assignee", params.assignee.as_ref());
        q.opt("country", params.country.as_ref());
        q.opt("language", params.language.as_ref());
        q.opt("status", params.status.as_ref());
        q.opt("patent_type", params.patent_type.as_ref());
        q.opt("before", params.before.as_ref());
        q.opt("after", params.after.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Google immersive product detail
    ///
    /// Get deep product details from Google's immersive product page.
    ///
    /// Two-step fetch: render the Shopping SERP for ``q`` to extract
    /// session-bound tokens, then call ``/async/oapv`` with them. Returns
    /// 404 when the product isn't on the SERP — the caller's query has to
    /// surface the tile because the tokens are session-scoped.
    ///
    /// Response time: ~3 s warm (cached SERP), ~6 s cold (SERP + RPC).
    /// `GET /api/v1/products/detail`
    pub async fn get_product_detail(
        &self,
        params: GetProductDetailParams,
    ) -> Result<ProductDetailResponse> {
        let path = "/api/v1/products/detail".to_string();
        let mut q = QueryParams::new();
        q.opt("product_id", params.product_id.as_ref());
        q.opt("q", params.q.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("domain", params.domain.as_ref());
        q.opt("include_offers", params.include_offers.as_ref());
        q.opt("include_variants", params.include_variants.as_ref());
        q.opt("resolve_deep_urls", params.resolve_deep_urls.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Get Google Scholar author profile
    ///
    /// Get detailed Google Scholar author profile including articles, stats, and co-authors.
    /// `GET /api/v1/scholar/author`
    pub async fn scholar_author(
        &self,
        params: ScholarAuthorParams,
    ) -> Result<ScholarAuthorResponse> {
        let path = "/api/v1/scholar/author".to_string();
        let mut q = QueryParams::new();
        q.opt("author_id", params.author_id.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("cstart", params.cstart.as_ref());
        q.opt("pagesize", params.pagesize.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Get citation chart data for a Scholar author
    ///
    /// Return the citations-per-year chart for a Google Scholar author.
    /// `GET /api/v1/scholar/author/citation`
    pub async fn scholar_author_citation(
        &self,
        params: ScholarAuthorCitationParams,
    ) -> Result<ScholarAuthorCitationResponse> {
        let path = "/api/v1/scholar/author/citation".to_string();
        let mut q = QueryParams::new();
        q.opt("author_id", params.author_id.as_ref());
        q.opt("hl", params.hl.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Get citation formats for a Scholar paper
    ///
    /// Return MLA, APA, Chicago, Harvard, and Vancouver citation formats.
    ///
    /// **Currently returns HTTP 501.** Google's cite-dialog endpoint
    /// (``/scholar?q=info:<cluster>:scholar.google.com/&output=cite``)
    /// returns ``HTTP 403 Forbidden`` for every unauthenticated client as of
    /// late 2026 — the dialog is only served to browsers that have an
    /// active Scholar JS session established via a prior `/scholar` page
    /// load. Working around that requires a stateful browser session which
    /// `GET /api/v1/scholar/cite`
    pub async fn scholar_cite(&self, params: ScholarCiteParams) -> Result<ScholarCiteResponse> {
        let path = "/api/v1/scholar/cite".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("hl", params.hl.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Search Google Scholar author profiles
    ///
    /// Search Google Scholar for author profiles by name.
    ///
    /// Google auth-gates the direct ``view_op=search_authors`` endpoint for
    /// unauthenticated clients, so this handler falls back to a regular
    /// ``/scholar?q=<name>`` search and harvests unique
    /// ``/citations?user=<id>`` links from each result's author byline
    /// (``gs_a`` div). The response schema is unchanged — each
    /// ``ScholarProfile`` carries ``author_id``, ``name``, and ``link``.
    /// `GET /api/v1/scholar/profiles`
    pub async fn scholar_profiles(
        &self,
        params: ScholarProfilesParams,
    ) -> Result<ScholarProfilesResponse> {
        let path = "/api/v1/scholar/profiles".to_string();
        let mut q = QueryParams::new();
        q.opt("mauthors", params.mauthors.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("after_author", params.after_author.as_ref());
        q.opt("before_author", params.before_author.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Search Google Scholar
    ///
    /// Search Google Scholar for scholarly articles using direct HTTP.
    /// `GET /api/v1/scholar/search`
    pub async fn search_scholar(
        &self,
        params: SearchScholarParams,
    ) -> Result<ScholarSearchResponse> {
        let path = "/api/v1/scholar/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("as_ylo", params.as_ylo.as_ref());
        q.opt("as_yhi", params.as_yhi.as_ref());
        q.opt("as_sdt", params.as_sdt.as_ref());
        q.opt("page", params.page.as_ref());
        q.opt("num", params.num.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Google web search
    ///
    /// Search Google and get structured results.
    ///
    /// Two response modes:
    ///
    /// - **full** (default, 2 credits): complete SERP with organic, ads,
    /// knowledge graph, People Also Ask, AI Overview, local pack, news,
    /// related searches, inline videos, etc. ~1.5-2s cold, ~1.5ms warm.
    /// - **fast** (1 credit, ~40% faster): lite endpoint (`gbv=1`) returning
    /// `GET /api/v1/search`
    pub async fn search(&self, params: SearchParams) -> Result<GoogleSearchResponse> {
        let path = "/api/v1/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("num", params.num.as_ref());
        q.opt("start", params.start.as_ref());
        q.opt("domain", params.domain.as_ref());
        q.opt("device", params.device.as_ref());
        q.opt("location", params.location.as_ref());
        q.opt("lr", params.lr.as_ref());
        q.opt("tbs", params.tbs.as_ref());
        q.opt("safe", params.safe.as_ref());
        q.opt("uule", params.uule.as_ref());
        q.opt("filter", params.filter.as_ref());
        q.opt("nfpr", params.nfpr.as_ref());
        q.opt("cr", params.cr.as_ref());
        q.opt("ludocid", params.ludocid.as_ref());
        q.opt("lsig", params.lsig.as_ref());
        q.opt("kgmid", params.kgmid.as_ref());
        q.opt("si", params.si.as_ref());
        q.opt("ibp", params.ibp.as_ref());
        q.opt("uds", params.uds.as_ref());
        q.opt("ai_overview", params.ai_overview.as_ref());
        q.opt("mode", params.mode.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Product details
    ///
    /// Get detailed product information with seller offers.
    /// `GET /api/v1/shopping/product`
    pub async fn shopping_product(
        &self,
        params: ShoppingProductParams,
    ) -> Result<ShoppingProductResponse> {
        let path = "/api/v1/shopping/product".to_string();
        let mut q = QueryParams::new();
        q.opt("product_id", params.product_id.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Resolve merchant URL for a Google Shopping product
    ///
    /// Resolve the real merchant URL for a product from Google Shopping.
    ///
    /// Google has removed direct merchant links from organic Shopping HTML,
    /// so the public /shopping/search response can only return the product
    /// title + price + source. This endpoint takes a product title (and
    /// optionally the source merchant) and uses Google's "I'm Feeling Lucky"
    /// redirect (`btnI=1`) to materialize the top merchant URL, mirroring
    /// the per-product enrichment pattern exposes via
    /// `GET /api/v1/shopping/product/click`
    pub async fn shopping_product_click(
        &self,
        params: ShoppingProductClickParams,
    ) -> Result<ShoppingClickResponse> {
        let path = "/api/v1/shopping/product/click".to_string();
        let mut q = QueryParams::new();
        q.opt("title", params.title.as_ref());
        q.opt("source", params.source.as_ref());
        q.opt("q", params.q.as_ref());
        q.opt("product_id", params.product_id.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Search Google Shopping
    ///
    /// Search Google Shopping for products.
    ///
    /// Requires browser rendering due to dynamic JS-loaded content.
    /// `GET /api/v1/shopping/search`
    pub async fn shopping_search(
        &self,
        params: ShoppingSearchParams,
    ) -> Result<ShoppingSearchResponse> {
        let path = "/api/v1/shopping/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("min_price", params.min_price.as_ref());
        q.opt("max_price", params.max_price.as_ref());
        q.opt("sort_by", params.sort_by.as_ref());
        q.opt("free_shipping", params.free_shipping.as_ref());
        q.opt("on_sale", params.on_sale.as_ref());
        q.opt("start", params.start.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Google Shorts search
    ///
    /// Return Google Shorts — short-form vertical videos surfaced in search.
    ///
    /// Triggers Google's Shorts mode via `udm=39` and parses out the
    /// `short_videos_results` carousel. Mostly returns YouTube Shorts but also
    /// includes TikToks, Facebook Reels, and other short-form sources when
    /// Google surfaces them.
    /// `GET /api/v1/shorts/search`
    pub async fn shorts_search(&self, params: ShortsSearchParams) -> Result<GoogleShortsResponse> {
        let path = "/api/v1/shorts/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("domain", params.domain.as_ref());
        q.opt("num", params.num.as_ref());
        q.opt("start", params.start.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Trends topic autocomplete
    ///
    /// Return categorized topic entities from the Google Trends autocomplete API.
    ///
    /// Unlike Google Search autocomplete (which returns flat keyword suggestions),
    /// this endpoint returns Knowledge Graph entities each tagged with a `type`
    /// and a machine identifier (`mid`) — the same data that powers the Trends
    /// UI's "Search topic" picker. Each entry includes a direct link into the
    /// Trends explore view for that topic.
    /// `GET /api/v1/trends/autocomplete`
    pub async fn trends_autocomplete(
        &self,
        params: TrendsAutocompleteParams,
    ) -> Result<TrendsAutocompleteResponse> {
        let path = "/api/v1/trends/autocomplete".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("tz", params.tz.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Interest over time
    ///
    /// Get interest over time for search terms via Google Trends internal API.
    /// `GET /api/v1/trends/interest`
    pub async fn trends_interest(
        &self,
        params: TrendsInterestParams,
    ) -> Result<TrendsInterestResponse> {
        let path = "/api/v1/trends/interest".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("geo", params.geo.as_ref());
        q.opt("date", params.date.as_ref());
        q.opt("category", params.category.as_ref());
        q.opt("gprop", params.gprop.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Interest by region
    ///
    /// Get interest by region for a search term.
    ///
    /// Google's widget has a resolution hierarchy — you can't ask for
    /// country-level data inside a specific country. Passing
    /// ``resolution=auto`` (the default) uses whatever resolution the
    /// widget itself returned, which is always valid.
    /// `GET /api/v1/trends/regions`
    pub async fn trends_regions(
        &self,
        params: TrendsRegionsParams,
    ) -> Result<TrendsRegionsResponse> {
        let path = "/api/v1/trends/regions".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("geo", params.geo.as_ref());
        q.opt("date", params.date.as_ref());
        q.opt("resolution", params.resolution.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Related topics & queries
    ///
    /// Get related topics and queries for a search term.
    /// `GET /api/v1/trends/related`
    pub async fn trends_related(
        &self,
        params: TrendsRelatedParams,
    ) -> Result<TrendsRelatedResponse> {
        let path = "/api/v1/trends/related".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("geo", params.geo.as_ref());
        q.opt("date", params.date.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Google Trends — unified search
    ///
    /// Unified Google Trends dispatcher. Pick the shape via `data_type`.
    /// `GET /api/v1/trends/search`
    pub async fn trends_search(&self, params: TrendsSearchParams) -> Result<TrendsSearchResponse> {
        let path = "/api/v1/trends/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("data_type", params.data_type.as_ref());
        q.opt("geo", params.geo.as_ref());
        q.opt("date", params.date.as_ref());
        q.opt("cat", params.cat.as_ref());
        q.opt("gprop", params.gprop.as_ref());
        q.opt("region", params.region.as_ref());
        q.opt("language", params.language.as_ref());
        q.opt("tz", params.tz.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Trending searches
    ///
    /// Get trending searches with related queries via Google's TrendsUi.
    ///
    /// Primary path: ``POST /_/TrendsUi/data/batchexecute?rpcids=i0OFE``,
    /// Google's internal RPC backend for the ``/trending`` page. This
    /// endpoint is **not** protected by SearchGuard / BotGuard — no
    /// cookies or anti-abuse token required — and returns the trending
    /// list **with related queries embedded per trend** (10-25 queries
    /// each), the same data that powers the trending UI's expanded view.
    /// `GET /api/v1/trends/trending`
    pub async fn trends_trending(
        &self,
        params: TrendsTrendingParams,
    ) -> Result<TrendsTrendingResponse> {
        let path = "/api/v1/trends/trending".to_string();
        let mut q = QueryParams::new();
        q.opt("geo", params.geo.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("hours", params.hours.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Google Trends — current trending searches
    ///
    /// Current trending searches with the full Google Trends UI filters.
    ///
    /// ``geo`` honored by the upstream feed. ``category`` is passed through
    /// as ``cat=<letter>``; when the feed ignores it we still return the
    /// base result set so callers get *something* useful. ``status`` and
    /// ``sort`` are applied client-side against the parsed result list.
    /// `GET /api/v1/trends/trending-now`
    pub async fn trends_trending_now(
        &self,
        params: TrendsTrendingNowParams,
    ) -> Result<TrendsTrendingResponse> {
        let path = "/api/v1/trends/trending-now".to_string();
        let mut q = QueryParams::new();
        q.opt("geo", params.geo.as_ref());
        q.opt("hours", params.hours.as_ref());
        q.opt("category", params.category.as_ref());
        q.opt("status", params.status.as_ref());
        q.opt("sort", params.sort.as_ref());
        q.opt("hl", params.hl.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }

    /// Search Google Videos
    ///
    /// Search Google for video results.
    /// `GET /api/v1/videos/search`
    pub async fn search_videos(&self, params: SearchVideosParams) -> Result<VideosSearchResponse> {
        let path = "/api/v1/videos/search".to_string();
        let mut q = QueryParams::new();
        q.opt("q", params.q.as_ref());
        q.opt("gl", params.gl.as_ref());
        q.opt("hl", params.hl.as_ref());
        q.opt("tbs", params.tbs.as_ref());
        q.opt("safe", params.safe.as_ref());
        q.opt("page", params.page.as_ref());
        let query = q.into_pairs();
        let body = None;
        self.client.send(Method::GET, &path, &query, body).await
    }
}

// ===== Models =====

/// A sponsored/ad result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct AdResult {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub description: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub displayed_link: Option<String>,
    pub extensions: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub position: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/ai-mode/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct AiModeResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub country: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub language: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    pub references: Vec<AiReference>,
    pub text_blocks: Vec<AiTextBlock>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Google AI Overview (AI-generated summary).
///
/// Google increasingly serves the AI Overview as a **deferred** block — the
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct AiOverview {
    /// True when the AI Overview was present as a deferred block.
    #[serde(default, deserialize_with = "crate::core::flex::opt_bool")]
    pub deferred: Option<bool>,
    /// Continuation token for the deferred AI Overview fetch. Non-null when Google embeds only a placeholder in the main SERP response.
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub page_token: Option<String>,
    pub references: Vec<AiOverviewReference>,
    pub text_blocks: Vec<AiOverviewTextBlock>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A list item within an AI Overview text block.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct AiOverviewListItem {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub snippet: Option<String>,
    pub snippet_links: Vec<SnippetLink>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A source reference in AI Overview.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct AiOverviewReference {
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub index: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub logo: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub snippet: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A typed content block within AI Overview.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct AiOverviewTextBlock {
    pub list_items: Vec<AiOverviewListItem>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub snippet: Option<String>,
    pub snippet_links: Vec<SnippetLink>,
    #[serde(rename = "type")]
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub type_: Option<String>,
    pub video: Option<AiOverviewVideo>,
    pub video_links: Vec<AiOverviewVideo>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Video reference in AI Overview.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct AiOverviewVideo {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub channel: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub duration: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A reference cited in the AI response.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct AiReference {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub snippet: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A block of AI-generated text.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct AiTextBlock {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub snippet: Option<String>,
    #[serde(rename = "type")]
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub type_: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/autocomplete/.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct AutocompleteResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub country: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub language: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    pub suggestions: Vec<AutocompleteSuggestion>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single autocomplete suggestion.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct AutocompleteSuggestion {
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub relevance: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub value: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// One point in the citations-per-year chart.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct CitationByYear {
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub citations: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub year: Option<i64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/finance/quote.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct FinanceQuoteResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub currency: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub exchange: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub price: Option<f64>,
    pub price_movement: Option<PriceMovement>,
    pub stats: Option<FinanceStats>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub stock: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Key financial statistics.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct FinanceStats {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub day_range: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub market_cap: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub pe_ratio: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub prev_close: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub year_range: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Airport metadata referenced in a search result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct FlightAirport {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub city: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub country: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub iata_code: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A layover between two legs in a multi-segment itinerary.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct FlightLayover {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub airport: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub airport_name: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub duration_minutes: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_bool")]
    pub overnight: Option<bool>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// One segment of a flight itinerary (e.g. SFO → LHR on a connection).
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct FlightLeg {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub aircraft: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub airline: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub airline_logo: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub arrival_airport: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub arrival_airport_name: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub arrival_time: Option<String>,
    /// IATA code
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub departure_airport: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub departure_airport_name: Option<String>,
    /// ISO-8601 local time of departure
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub departure_time: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub duration_minutes: Option<i64>,
    pub extensions: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub flight_number: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub legroom: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub travel_class: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single end-to-end flight itinerary that appears in the results.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct FlightOffer {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub airline_logo: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub booking_token: Option<String>,
    /// Difference vs typical emissions for this route, in grams
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub carbon_emissions_diff_typical: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub carbon_emissions_grams: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub currency: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub departure_token: Option<String>,
    pub extensions: Vec<String>,
    pub layovers: Vec<FlightLayover>,
    pub legs: Vec<FlightLeg>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub price: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub price_type: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub total_duration_minutes: Option<i64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Typical price range insight for the searched route.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct FlightPriceInsights {
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub lowest_price: Option<f64>,
    /// Historical price points as [[unix_timestamp, price], ...]
    pub price_history: Option<Vec<Vec<f64>>>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub price_level: Option<String>,
    /// [min, max] typical price for this route
    pub typical_price_range: Option<Vec<f64>>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Max stops filter
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum FlightsSearchStops {
    /// `any`
    #[serde(rename = "any")]
    Any,
    /// `nonstop`
    #[serde(rename = "nonstop")]
    Nonstop,
    /// `one_stop`
    #[serde(rename = "one_stop")]
    OneStop,
    /// `two_stops`
    #[serde(rename = "two_stops")]
    TwoStops,
}

impl std::fmt::Display for FlightsSearchStops {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            FlightsSearchStops::Any => "any",
            FlightsSearchStops::Nonstop => "nonstop",
            FlightsSearchStops::OneStop => "one_stop",
            FlightsSearchStops::TwoStops => "two_stops",
        })
    }
}

/// Cabin class
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum FlightsSearchTravelClass {
    /// `economy`
    #[serde(rename = "economy")]
    Economy,
    /// `premium_economy`
    #[serde(rename = "premium_economy")]
    PremiumEconomy,
    /// `business`
    #[serde(rename = "business")]
    Business,
    /// `first`
    #[serde(rename = "first")]
    First,
}

impl std::fmt::Display for FlightsSearchTravelClass {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            FlightsSearchTravelClass::Economy => "economy",
            FlightsSearchTravelClass::PremiumEconomy => "premium_economy",
            FlightsSearchTravelClass::Business => "business",
            FlightsSearchTravelClass::First => "first",
        })
    }
}

/// Trip type: round_trip | one_way | multi_city
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum FlightsSearchTripType {
    /// `one_way`
    #[serde(rename = "one_way")]
    OneWay,
    /// `round_trip`
    #[serde(rename = "round_trip")]
    RoundTrip,
    /// `multi_city`
    #[serde(rename = "multi_city")]
    MultiCity,
}

impl std::fmt::Display for FlightsSearchTripType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            FlightsSearchTripType::OneWay => "one_way",
            FlightsSearchTripType::RoundTrip => "round_trip",
            FlightsSearchTripType::MultiCity => "multi_city",
        })
    }
}

/// Response for GET /api/v1/flights/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct GoogleFlightsResponse {
    pub airports: Vec<FlightAirport>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub arrival_id: Option<String>,
    pub best_flights: Vec<FlightOffer>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub currency: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub departure_id: Option<String>,
    pub other_flights: Vec<FlightOffer>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub outbound_date: Option<String>,
    pub price_insights: Option<FlightPriceInsights>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub return_date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub trip_type: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/local/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct GoogleLocalResponse {
    pub local_results: Vec<LocalResult>,
    pub search_information: Option<SearchInformation>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct GoogleSearchResponse {
    pub ads: Vec<AdResult>,
    pub ai_overview: Option<AiOverview>,
    pub inline_videos: Vec<InlineVideo>,
    pub knowledge_graph: Option<KnowledgeGraph>,
    pub local_results: Vec<LocalResult>,
    pub news_results: Vec<NewsResult>,
    pub organic_results: Vec<OrganicResult>,
    pub pagination: Option<Pagination>,
    pub related_questions: Vec<RelatedQuestion>,
    pub related_searches: Vec<RelatedSearch>,
    pub search_information: Option<SearchInformation>,
    pub shopping_results: Vec<ShoppingResult>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/shorts/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct GoogleShortsResponse {
    pub search_information: Option<SearchInformation>,
    pub short_videos_results: Vec<ShortVideoResult>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// GPS coordinates.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct GpsCoordinates {
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub lat: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub lng: Option<f64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/hotels/details.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct HotelDetailResponse {
    pub property: Option<HotelProperty>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A place near the hotel.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct HotelNearbyPlace {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub duration: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub transport: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A hotel price from a specific source.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct HotelPrice {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub cancellation_policy: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub currency: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub price: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A hotel search result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct HotelProperty {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub address: Option<String>,
    pub amenities: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub check_in_time: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub check_out_time: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub description: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_bool")]
    pub eco_certified: Option<bool>,
    pub gps_coordinates: Option<GpsCoordinates>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub hotel_class: Option<i64>,
    pub images: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    pub nearby_places: Vec<HotelNearbyPlace>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub overall_rating: Option<f64>,
    pub prices: Vec<HotelPrice>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub property_token: Option<String>,
    pub rate_per_night: Option<HotelRate>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub reviews_count: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    pub total_rate: Option<HotelRate>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Hotel rate information.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct HotelRate {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub currency: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub extracted: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub lowest: Option<f64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/hotels/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct HotelsSearchResponse {
    pub pagination: Option<Pagination>,
    pub properties: Vec<HotelProperty>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct HttpValidationError {
    pub detail: Vec<ValidationError>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single image search result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ImageResult {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub original: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub original_height: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub original_width: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub position: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/images/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ImagesSearchResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub country: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub language: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    pub results: Vec<ImageResult>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// An inline sitelink (e.g. Reddit post metadata).
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct InlineSitelink {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Inline video result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct InlineVideo {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub duration: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub platform: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub position: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A job application link.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct JobApplyOption {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A filter option for job search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct JobFilter {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    pub options: Vec<JobFilterOption>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single filter option value.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct JobFilterOption {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub label: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub value: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Structured job highlights.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct JobHighlights {
    pub benefits: Vec<String>,
    pub qualifications: Vec<String>,
    pub responsibilities: Vec<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single job listing.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct JobResult {
    /// Flat list of apply URLs for quick access.
    pub apply_links: Vec<String>,
    pub apply_options: Vec<JobApplyOption>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub company_name: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub description: Option<String>,
    pub extensions: Vec<String>,
    pub job_highlights: Option<JobHighlights>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub job_type: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub location: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub posted_at: Option<String>,
    pub salary: Option<JobSalary>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub schedule_type: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Canonical Google Jobs listing URL.
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub url: Option<String>,
    /// Source platform ("Talent.com", "Built In NYC", …) parsed from "via X".
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub via: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_bool")]
    pub work_from_home: Option<bool>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Job salary information.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct JobSalary {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub currency: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub max: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub min: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub period: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Allowed values for a fixed-value query parameter.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum JobsSearchDatePosted {
    /// `today`
    #[serde(rename = "today")]
    Today,
    /// `3days`
    #[serde(rename = "3days")]
    V3days,
    /// `week`
    #[serde(rename = "week")]
    Week,
    /// `month`
    #[serde(rename = "month")]
    Month,
}

impl std::fmt::Display for JobsSearchDatePosted {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            JobsSearchDatePosted::Today => "today",
            JobsSearchDatePosted::V3days => "3days",
            JobsSearchDatePosted::Week => "week",
            JobsSearchDatePosted::Month => "month",
        })
    }
}

/// Allowed values for a fixed-value query parameter.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum JobsSearchJobType {
    /// `FULLTIME`
    #[serde(rename = "FULLTIME")]
    Fulltime,
    /// `PARTTIME`
    #[serde(rename = "PARTTIME")]
    Parttime,
    /// `CONTRACTOR`
    #[serde(rename = "CONTRACTOR")]
    Contractor,
    /// `INTERN`
    #[serde(rename = "INTERN")]
    Intern,
}

impl std::fmt::Display for JobsSearchJobType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            JobsSearchJobType::Fulltime => "FULLTIME",
            JobsSearchJobType::Parttime => "PARTTIME",
            JobsSearchJobType::Contractor => "CONTRACTOR",
            JobsSearchJobType::Intern => "INTERN",
        })
    }
}

/// Allowed values for a fixed-value query parameter.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum JobsSearchLtype {
    /// `remote`
    #[serde(rename = "remote")]
    Remote,
    /// `hybrid`
    #[serde(rename = "hybrid")]
    Hybrid,
    /// `onsite`
    #[serde(rename = "onsite")]
    Onsite,
    /// `work_from_home`
    #[serde(rename = "work_from_home")]
    WorkFromHome,
}

impl std::fmt::Display for JobsSearchLtype {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            JobsSearchLtype::Remote => "remote",
            JobsSearchLtype::Hybrid => "hybrid",
            JobsSearchLtype::Onsite => "onsite",
            JobsSearchLtype::WorkFromHome => "work_from_home",
        })
    }
}

/// Data source. ``rpc`` (default, ~300 ms) replays Google's own ``r06xKb`` batchexecute RPC on the Google Careers portal — clean JSON, 20 roles per page, scope = Google's internal openings. ``serp`` uses the public Jobs search vertical (``udm=8``, SERP-embedded, 3rd-party aggregator) and costs more latency because Google gates it behind JS.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum JobsSearchMode {
    /// `rpc`
    #[serde(rename = "rpc")]
    Rpc,
    /// `serp`
    #[serde(rename = "serp")]
    Serp,
}

impl std::fmt::Display for JobsSearchMode {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            JobsSearchMode::Rpc => "rpc",
            JobsSearchMode::Serp => "serp",
        })
    }
}

/// Response for GET /api/v1/jobs/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct JobsSearchResponse {
    pub filters: Vec<JobFilter>,
    pub jobs: Vec<JobResult>,
    pub jobs_results: Vec<JobResult>,
    pub pagination: Option<Pagination>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Knowledge Graph panel.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct KnowledgeGraph {
    pub attributes: HashMap<String, String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub description: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub image: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    #[serde(rename = "type")]
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub type_: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single visual search result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct LensResult {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub position: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/lens/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct LensSearchResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub image_url: Option<String>,
    pub results: Vec<LensResult>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Local pack result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct LocalResult {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub address: Option<String>,
    pub gps_coordinates: Option<GpsCoordinates>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub phone: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub place_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub rating: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub reviews: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    #[serde(rename = "type")]
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub type_: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Business identity shown alongside posts (matches shape).
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsLocationDetails {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub logo: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Location summary in review responses.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsLocationInfo {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub address: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub rating: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub reviews_count: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Business owner response to a review.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsOwnerResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub text: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A place photo.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsPhoto {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub image: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A photo category.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsPhotoCategory {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/maps/photos.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsPhotosResponse {
    pub categories: Vec<MapsPhotoCategory>,
    pub pagination: Option<Pagination>,
    pub photos: Vec<MapsPhoto>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Detailed place information.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsPlaceDetail {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub address: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub data_cid: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub data_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub description: Option<String>,
    pub extensions: HashMap<String, HashMap<String, Value>>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub google_maps_url: Option<String>,
    pub gps_coordinates: Option<GpsCoordinates>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub hours: Option<String>,
    /// Full-size image URL (same CDN as thumbnail but larger)
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub image: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub open_state: Option<String>,
    pub operating_hours: HashMap<String, String>,
    pub order_online_urls: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub phone: Option<String>,
    pub photos: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub photos_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub place_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub posts_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub price_level: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub provider_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub rank: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub rating: Option<f64>,
    pub rating_breakdown: HashMap<String, i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub reviews_count: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub reviews_link: Option<String>,
    pub service_options: Option<MapsServiceOptions>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    #[serde(rename = "type")]
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub type_: Option<String>,
    pub type_ids: Vec<String>,
    pub types: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub website: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/maps/place.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsPlaceResponse {
    pub place: Option<MapsPlaceDetail>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A place from Maps search results.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsPlaceResult {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub address: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub data_cid: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub data_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub description: Option<String>,
    pub extensions: Vec<HashMap<String, Vec<String>>>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub google_maps_url: Option<String>,
    pub gps_coordinates: Option<GpsCoordinates>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub hours: Option<String>,
    /// Full-size image URL (same CDN as thumbnail but larger)
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub image: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub open_state: Option<String>,
    pub operating_hours: HashMap<String, String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub phone: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub photos_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub place_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub posts_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub price_level: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub rank: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub rating: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub reviews_count: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub reviews_link: Option<String>,
    pub service_options: Option<MapsServiceOptions>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    #[serde(rename = "type")]
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub type_: Option<String>,
    pub type_ids: Vec<String>,
    pub types: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub website: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A business post or update.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsPost {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub description: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub image: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/maps/posts.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsPostsResponse {
    /// True when the SERP knowledge panel shows an 'Updates from' section
    #[serde(default, deserialize_with = "crate::core::flex::opt_bool")]
    pub has_updates: Option<bool>,
    pub location_details: Option<MapsLocationDetails>,
    /// The 'From the business' description text set by the business owner
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub merchant_description: Option<String>,
    pub pagination: Option<Pagination>,
    pub post_data: Vec<MapsPost>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single place review.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsReview {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub date: Option<String>,
    pub images: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub iso_date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub likes: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub rating: Option<i64>,
    pub response_from_owner: Option<MapsOwnerResponse>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub text: Option<String>,
    pub user: Option<MapsReviewUser>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A review topic/keyword.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsReviewTopic {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub keyword: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub mentions: Option<i64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// User who wrote a review.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsReviewUser {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub contributor_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_bool")]
    pub local_guide: Option<bool>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub photos_count: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub reviews_count: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/maps/reviews.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsReviewsResponse {
    pub location: Option<MapsLocationInfo>,
    pub pagination: Option<Pagination>,
    pub reviews: Vec<MapsReview>,
    pub topics: Vec<MapsReviewTopic>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Sort order
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum MapsReviewsSortBy {
    /// `qualityScore`
    #[serde(rename = "qualityScore")]
    QualityScore,
    /// `newestFirst`
    #[serde(rename = "newestFirst")]
    NewestFirst,
    /// `ratingHigh`
    #[serde(rename = "ratingHigh")]
    RatingHigh,
    /// `ratingLow`
    #[serde(rename = "ratingLow")]
    RatingLow,
}

impl std::fmt::Display for MapsReviewsSortBy {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            MapsReviewsSortBy::QualityScore => "qualityScore",
            MapsReviewsSortBy::NewestFirst => "newestFirst",
            MapsReviewsSortBy::RatingHigh => "ratingHigh",
            MapsReviewsSortBy::RatingLow => "ratingLow",
        })
    }
}

/// Response for GET /api/v1/maps/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsSearchResponse {
    pub pagination: Option<Pagination>,
    pub results: Vec<MapsPlaceResult>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Service options for a business.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct MapsServiceOptions {
    #[serde(default, deserialize_with = "crate::core::flex::opt_bool")]
    pub curbside_pickup: Option<bool>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_bool")]
    pub delivery: Option<bool>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_bool")]
    pub dine_in: Option<bool>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_bool")]
    pub takeout: Option<bool>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single news article.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct NewsArticle {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub published_at: Option<String>,
    pub related_stories: Vec<NewsRelatedStory>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub snippet: Option<String>,
    pub source: Option<NewsSource>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Topic name
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum NewsByTopicTopic {
    /// `WORLD`
    #[serde(rename = "WORLD")]
    World,
    /// `BUSINESS`
    #[serde(rename = "BUSINESS")]
    Business,
    /// `TECHNOLOGY`
    #[serde(rename = "TECHNOLOGY")]
    Technology,
    /// `ENTERTAINMENT`
    #[serde(rename = "ENTERTAINMENT")]
    Entertainment,
    /// `SPORTS`
    #[serde(rename = "SPORTS")]
    Sports,
    /// `SCIENCE`
    #[serde(rename = "SCIENCE")]
    Science,
    /// `HEALTH`
    #[serde(rename = "HEALTH")]
    Health,
}

impl std::fmt::Display for NewsByTopicTopic {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            NewsByTopicTopic::World => "WORLD",
            NewsByTopicTopic::Business => "BUSINESS",
            NewsByTopicTopic::Technology => "TECHNOLOGY",
            NewsByTopicTopic::Entertainment => "ENTERTAINMENT",
            NewsByTopicTopic::Sports => "SPORTS",
            NewsByTopicTopic::Science => "SCIENCE",
            NewsByTopicTopic::Health => "HEALTH",
        })
    }
}

/// A related story within a news cluster.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct NewsRelatedStory {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub published_at: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Inline news/top stories result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct NewsResult {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/news/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct NewsSearchResponse {
    pub articles: Vec<NewsArticle>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub country: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub language: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// News article source.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct NewsSource {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub icon: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub url: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/news/topics.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct NewsTopicsResponse {
    pub articles: Vec<NewsArticle>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub country: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub language: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub topic: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/news/trending.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct NewsTrendingResponse {
    pub articles: Vec<NewsArticle>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub country: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub language: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single organic search result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct OrganicResult {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub displayed_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub favicon: Option<String>,
    pub highlighted_keywords: Vec<String>,
    pub inline_sitelinks: Vec<InlineSitelink>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub page_rank: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub position: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub rank: Option<i64>,
    pub sitelinks: Vec<Sitelink>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub snippet: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Pagination metadata.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct Pagination {
    pub current: Option<Value>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub next: Option<String>,
    pub page_no: HashMap<String, String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub total_pages: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub total_results: Option<i64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A patent citation reference.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct PatentCitation {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub assignee: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub filing_date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub patent_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Detailed patent information from /xhr/result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct PatentDetail {
    #[serde(rename = "abstract")]
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub abstract_: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub application_number: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub assignee: Option<String>,
    pub citations: Vec<PatentCitation>,
    pub claims: Vec<String>,
    pub classifications: Vec<String>,
    pub country_status: HashMap<String, String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub description: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub expiration_date: Option<String>,
    pub figures: Vec<PatentFigure>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub filing_date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub grant_date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub inventor: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub language: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub patent_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub pdf_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub priority_date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub publication_date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub publication_number: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub snippet: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/patents/detail.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct PatentDetailResponse {
    pub patent: Option<PatentDetail>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Patent figure/drawing.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct PatentFigure {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub url: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single patent search result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct PatentResult {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub assignee: Option<String>,
    pub country_status: HashMap<String, String>,
    pub figures: Vec<PatentFigure>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub filing_date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub grant_date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub inventor: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub language: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub patent_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub pdf_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub priority_date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub publication_date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub publication_number: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub snippet: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/patents/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct PatentSearchResponse {
    pub pagination: Option<Pagination>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    pub results: Vec<PatentResult>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub total_results: Option<i64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Price movement data.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct PriceMovement {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub direction: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub percentage: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub value: Option<f64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/products/detail.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ProductDetailResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub brand: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub description: Option<String>,
    pub images: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub price_range: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub product_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub rating: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub reviews_count: Option<i64>,
    pub sellers: Vec<ProductSeller>,
    pub specs: HashMap<String, String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A seller offering the product.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ProductSeller {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub price: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub shipping: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// People Also Ask question.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct RelatedQuestion {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub displayed_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub question: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub rank: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub snippet: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source_logo: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Related search suggestion.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct RelatedSearch {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// One article row from the author profile's publication list.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ScholarAuthorArticle {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub authors: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub cited_by_count: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub cited_by_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub publication: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub year: Option<i64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/scholar/author/citation.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ScholarAuthorCitationResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub author_id: Option<String>,
    pub citations_by_year: Vec<CitationByYear>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub total_citations: Option<i64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Header block of a Scholar author profile page.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ScholarAuthorInfo {
    pub affiliations: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub author_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub email_domain: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub homepage: Option<String>,
    pub interests: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/scholar/author.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ScholarAuthorResponse {
    pub articles: Vec<ScholarAuthorArticle>,
    pub author: Option<ScholarAuthorInfo>,
    pub co_authors: Vec<ScholarCoAuthor>,
    pub stats: Option<ScholarAuthorStats>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Right-rail citation stats table.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ScholarAuthorStats {
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub citations_all: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub citations_since_year: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub h_index_all: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub h_index_since_year: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub i10_index_all: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub i10_index_since_year: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub since_year: Option<i64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single citation-style rendering (MLA, APA, Chicago, etc.).
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ScholarCitationFormat {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub citation: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub style: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Export link shown at the bottom of the cite dialog (BibTeX, RIS, ...).
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ScholarCitationLink {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/scholar/cite.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ScholarCiteResponse {
    pub citations: Vec<ScholarCitationFormat>,
    pub links: Vec<ScholarCitationLink>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Co-author card shown on the author profile page.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ScholarCoAuthor {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub affiliation: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub author_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// One author card from the Scholar profile search page.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ScholarProfile {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub affiliation: Option<String>,
    /// Google Scholar user ID (the `user` query parameter)
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub author_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub cited_by: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub email_domain: Option<String>,
    pub interests: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub position: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/scholar/profiles.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ScholarProfilesResponse {
    /// Pagination token for the next page
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub after_author: Option<String>,
    /// Pagination token for the previous page
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub before_author: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub language: Option<String>,
    pub profiles: Vec<ScholarProfile>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single scholarly article result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ScholarResult {
    pub authors: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub cited_by_count: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub cited_by_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub pdf_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub position: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub publication_info: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub related_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub snippet: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub versions_count: Option<i64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/scholar/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ScholarSearchResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub language: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    pub results: Vec<ScholarResult>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub total_results: Option<i64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Metadata about the search query.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct SearchInformation {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub organic_results_state: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query_displayed: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub time_taken: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub total_results: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub url: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response mode. **full** (default): complete SERP with all blocks (organic, ads, knowledge graph, local pack, AI overview, news, related questions, etc). **fast**: lite endpoint via `gbv=1` that returns ONLY organic results + related searches in ~0.6-1s cold (vs 1.5-2s full). Use when you only need organic results and can skip rich features.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum SearchMode {
    /// `full`
    #[serde(rename = "full")]
    Full,
    /// `fast`
    #[serde(rename = "fast")]
    Fast,
}

impl std::fmt::Display for SearchMode {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            SearchMode::Full => "full",
            SearchMode::Fast => "fast",
        })
    }
}

/// Allowed values for a fixed-value query parameter.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum SearchPatentsLanguage {
    /// `ENGLISH`
    #[serde(rename = "ENGLISH")]
    English,
    /// `GERMAN`
    #[serde(rename = "GERMAN")]
    German,
    /// `CHINESE`
    #[serde(rename = "CHINESE")]
    Chinese,
    /// `FRENCH`
    #[serde(rename = "FRENCH")]
    French,
    /// `JAPANESE`
    #[serde(rename = "JAPANESE")]
    Japanese,
    /// `KOREAN`
    #[serde(rename = "KOREAN")]
    Korean,
    /// `SPANISH`
    #[serde(rename = "SPANISH")]
    Spanish,
}

impl std::fmt::Display for SearchPatentsLanguage {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            SearchPatentsLanguage::English => "ENGLISH",
            SearchPatentsLanguage::German => "GERMAN",
            SearchPatentsLanguage::Chinese => "CHINESE",
            SearchPatentsLanguage::French => "FRENCH",
            SearchPatentsLanguage::Japanese => "JAPANESE",
            SearchPatentsLanguage::Korean => "KOREAN",
            SearchPatentsLanguage::Spanish => "SPANISH",
        })
    }
}

/// Allowed values for a fixed-value query parameter.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum SearchPatentsPatentType {
    /// `PATENT`
    #[serde(rename = "PATENT")]
    Patent,
    /// `DESIGN`
    #[serde(rename = "DESIGN")]
    Design,
}

impl std::fmt::Display for SearchPatentsPatentType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            SearchPatentsPatentType::Patent => "PATENT",
            SearchPatentsPatentType::Design => "DESIGN",
        })
    }
}

/// Allowed values for a fixed-value query parameter.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum SearchPatentsSort {
    /// `new`
    #[serde(rename = "new")]
    New,
    /// `old`
    #[serde(rename = "old")]
    Old,
}

impl std::fmt::Display for SearchPatentsSort {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            SearchPatentsSort::New => "new",
            SearchPatentsSort::Old => "old",
        })
    }
}

/// Allowed values for a fixed-value query parameter.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum SearchPatentsStatus {
    /// `GRANT`
    #[serde(rename = "GRANT")]
    Grant,
    /// `APPLICATION`
    #[serde(rename = "APPLICATION")]
    Application,
}

impl std::fmt::Display for SearchPatentsStatus {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            SearchPatentsStatus::Grant => "GRANT",
            SearchPatentsStatus::Application => "APPLICATION",
        })
    }
}

/// Response for GET /api/v1/shopping/product/click.
///
/// Returns the direct merchant URL for a given product title by using
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ShoppingClickResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub merchant_domain: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub merchant_url: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub product_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source_query: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A shopping filter group.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ShoppingFilter {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    pub options: Vec<ShoppingFilterOption>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single filter option.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ShoppingFilterOption {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub aria_label: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub label: Option<String>,
    #[serde(rename = "type")]
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub type_: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub value: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Product price.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ShoppingPrice {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub currency: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub extracted: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub value: Option<f64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Detailed product information.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ShoppingProductDetail {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub brand: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub currency: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub description: Option<String>,
    pub images: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub price_range_high: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub price_range_low: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub rating: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub reviews_count: Option<i64>,
    pub sellers: Vec<ShoppingSeller>,
    pub specs: HashMap<String, String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/shopping/product.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ShoppingProductResponse {
    pub product: Option<ShoppingProductDetail>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single product from search results.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ShoppingProductResult {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub click_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub delivery: Option<String>,
    pub extensions: Vec<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub old_price: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub old_price_extracted: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_bool")]
    pub on_sale: Option<bool>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub page_token: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub position: Option<i64>,
    pub price: Option<ShoppingPrice>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub product_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub rating: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub return_policy: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub reviews: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub reviews_count: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source_icon: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub tag: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Inline shopping result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ShoppingResult {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub price: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub rating: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub reviews: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/shopping/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ShoppingSearchResponse {
    pub ads: Vec<ShoppingProductResult>,
    pub filters: Vec<ShoppingFilter>,
    pub pagination: Option<Pagination>,
    pub results: Vec<ShoppingProductResult>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A seller offering the product.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ShoppingSeller {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub logo: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub name: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub original_price: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub price: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub rating: Option<f64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub reviews_count: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub shipping: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub tax: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_f64")]
    pub total_cost: Option<f64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single short-form video result surfaced in Google Shorts.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ShortVideoResult {
    /// Channel / account name
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub account: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub description: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub duration: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub position: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub published: Option<String>,
    /// Host domain (e.g. 'youtube.com', 'tiktok.com')
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub video_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub views: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A sitelink within an organic result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct Sitelink {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub snippet: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Inline link within an AI Overview text block.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct SnippetLink {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link_text: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A categorized topic suggestion returned by the Trends autocomplete API.
///
/// Distinct from Google Search autocomplete in that each entry is a
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct TrendsAutocompleteItem {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    /// Knowledge Graph machine ID (e.g. '/m/02vx4')
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub mid: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    #[serde(rename = "type")]
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub type_: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/trends/autocomplete.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct TrendsAutocompleteResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    pub results: Vec<TrendsAutocompleteItem>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/trends/interest.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct TrendsInterestResponse {
    pub averages: Vec<TrendsTimelineValue>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    pub timeline: Vec<TrendsTimelinePoint>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Interest for a specific region.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct TrendsRegionInterest {
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub max_value_index: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub region: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub region_code: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub value: Option<i64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Region granularity. `auto` (default) uses Google's widget default, which is `COUNTRY` for worldwide queries and `REGION` (state/province) for single-country queries. Overriding to `COUNTRY` when `geo` is set returns HTTP 400 from Google — use `REGION`, `DMA`, or `CITY` in that case.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum TrendsRegionsResolution {
    /// `COUNTRY`
    #[serde(rename = "COUNTRY")]
    Country,
    /// `REGION`
    #[serde(rename = "REGION")]
    Region,
    /// `DMA`
    #[serde(rename = "DMA")]
    Dma,
    /// `CITY`
    #[serde(rename = "CITY")]
    City,
    /// `auto`
    #[serde(rename = "auto")]
    Auto,
}

impl std::fmt::Display for TrendsRegionsResolution {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            TrendsRegionsResolution::Country => "COUNTRY",
            TrendsRegionsResolution::Region => "REGION",
            TrendsRegionsResolution::Dma => "DMA",
            TrendsRegionsResolution::City => "CITY",
            TrendsRegionsResolution::Auto => "auto",
        })
    }
}

/// Response for GET /api/v1/trends/regions.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct TrendsRegionsResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    pub regions: Vec<TrendsRegionInterest>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A related topic or query.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct TrendsRelatedItem {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub topic_id: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub topic_type: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub value: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/trends/related.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct TrendsRelatedResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    pub rising_queries: Vec<TrendsRelatedItem>,
    pub rising_topics: Vec<TrendsRelatedItem>,
    pub top_queries: Vec<TrendsRelatedItem>,
    pub top_topics: Vec<TrendsRelatedItem>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Dispatch on: TIMESERIES (interest over time), GEO_MAP (compared breakdown, multi-query), GEO_MAP_0 (interest by region, single query), RELATED_TOPICS (top + rising topics), RELATED_QUERIES (top + rising queries).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum TrendsSearchDataType {
    /// `TIMESERIES`
    #[serde(rename = "TIMESERIES")]
    Timeseries,
    /// `GEO_MAP`
    #[serde(rename = "GEO_MAP")]
    GeoMap,
    /// `GEO_MAP_0`
    #[serde(rename = "GEO_MAP_0")]
    GeoMap0,
    /// `RELATED_TOPICS`
    #[serde(rename = "RELATED_TOPICS")]
    RelatedTopics,
    /// `RELATED_QUERIES`
    #[serde(rename = "RELATED_QUERIES")]
    RelatedQueries,
}

impl std::fmt::Display for TrendsSearchDataType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            TrendsSearchDataType::Timeseries => "TIMESERIES",
            TrendsSearchDataType::GeoMap => "GEO_MAP",
            TrendsSearchDataType::GeoMap0 => "GEO_MAP_0",
            TrendsSearchDataType::RelatedTopics => "RELATED_TOPICS",
            TrendsSearchDataType::RelatedQueries => "RELATED_QUERIES",
        })
    }
}

/// Unified response for GET /api/v1/trends/search.
///
/// A single endpoint that dispatches on ``data_type``
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct TrendsSearchResponse {
    pub averages: Vec<TrendsTimelineValue>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub data_type: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    pub regions: Vec<TrendsRegionInterest>,
    pub rising_queries: Vec<TrendsRelatedItem>,
    pub rising_topics: Vec<TrendsRelatedItem>,
    pub timeline: Vec<TrendsTimelinePoint>,
    pub top_queries: Vec<TrendsRelatedItem>,
    pub top_topics: Vec<TrendsRelatedItem>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single point in interest over time.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct TrendsTimelinePoint {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub timestamp: Option<i64>,
    pub values: Vec<TrendsTimelineValue>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single value in a trends timeline point.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct TrendsTimelineValue {
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub extracted_value: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub value: Option<i64>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// An article associated with a trending search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct TrendsTrendingArticle {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A trending search item.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct TrendsTrendingItem {
    pub articles: Vec<TrendsTrendingArticle>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub traffic: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Sort order. ``relevance`` (default) keeps Google's ordering; ``search_volume`` orders by parsed traffic descending; ``title`` sorts alphabetically; ``recency`` falls back to relevance when the feed omits publication timestamps.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum TrendsTrendingNowSort {
    /// `relevance`
    #[serde(rename = "relevance")]
    Relevance,
    /// `search_volume`
    #[serde(rename = "search_volume")]
    SearchVolume,
    /// `title`
    #[serde(rename = "title")]
    Title,
    /// `recency`
    #[serde(rename = "recency")]
    Recency,
}

impl std::fmt::Display for TrendsTrendingNowSort {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            TrendsTrendingNowSort::Relevance => "relevance",
            TrendsTrendingNowSort::SearchVolume => "search_volume",
            TrendsTrendingNowSort::Title => "title",
            TrendsTrendingNowSort::Recency => "recency",
        })
    }
}

/// Trend state. ``active`` keeps only entries with a non-zero search volume (still surging); ``all`` (default) returns every entry including ended ones.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum TrendsTrendingNowStatus {
    /// `all`
    #[serde(rename = "all")]
    All,
    /// `active`
    #[serde(rename = "active")]
    Active,
}

impl std::fmt::Display for TrendsTrendingNowStatus {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            TrendsTrendingNowStatus::All => "all",
            TrendsTrendingNowStatus::Active => "active",
        })
    }
}

/// Response for GET /api/v1/trends/trending.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct TrendsTrendingResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub country: Option<String>,
    pub trending: Vec<TrendsTrendingItem>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct ValidationError {
    pub ctx: HashMap<String, Value>,
    pub input: Option<Value>,
    pub loc: Vec<Value>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub msg: Option<String>,
    #[serde(rename = "type")]
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub type_: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// A single video search result.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct VideoResult {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub date: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub displayed_link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub duration: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub link: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_i64")]
    pub position: Option<i64>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub source: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub thumbnail: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub title: Option<String>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Response for GET /api/v1/videos/search.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct VideosSearchResponse {
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub country: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub language: Option<String>,
    #[serde(default, deserialize_with = "crate::core::flex::opt_string")]
    pub query: Option<String>,
    pub results: Vec<VideoResult>,
    /// Fields present in the response but not in the spec.
    #[serde(flatten)]
    pub extra: HashMap<String, Value>,
}

/// Parameters for [`SearchAiModeParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct SearchAiModeParams {
    /// Search query for AI-generated response
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
}

/// Parameters for [`GetAutocompleteParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct GetAutocompleteParams {
    /// Search query to get suggestions for
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
}

/// Parameters for [`GetFinanceQuoteParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct GetFinanceQuoteParams {
    /// Stock ticker and exchange (e.g. "AAPL:NASDAQ", "GOOGL:NASDAQ", "BTC-USD")
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
}

/// Parameters for [`FlightsSearchParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct FlightsSearchParams {
    /// Departure airport IATA code (e.g. JFK) or location ID
    #[serde(skip_serializing_if = "Option::is_none")]
    pub departure_id: Option<String>,
    /// Arrival airport IATA code (e.g. LHR) or location ID
    #[serde(skip_serializing_if = "Option::is_none")]
    pub arrival_id: Option<String>,
    /// Outbound date (YYYY-MM-DD)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub outbound_date: Option<String>,
    /// Return date (YYYY-MM-DD, round-trip only)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub return_date: Option<String>,
    /// Trip type: round_trip | one_way | multi_city
    #[serde(skip_serializing_if = "Option::is_none")]
    pub trip_type: Option<FlightsSearchTripType>,
    /// Adult passengers
    #[serde(skip_serializing_if = "Option::is_none")]
    pub adults: Option<i64>,
    /// Children passengers
    #[serde(skip_serializing_if = "Option::is_none")]
    pub children: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub infants_in_seat: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub infants_on_lap: Option<i64>,
    /// Cabin class
    #[serde(skip_serializing_if = "Option::is_none")]
    pub travel_class: Option<FlightsSearchTravelClass>,
    /// ISO-4217 currency code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub currency: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Max stops filter
    #[serde(skip_serializing_if = "Option::is_none")]
    pub stops: Option<FlightsSearchStops>,
    /// Max price filter
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_price: Option<i64>,
}

/// Parameters for [`HotelDetailsParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct HotelDetailsParams {
    /// Property token from search results
    #[serde(skip_serializing_if = "Option::is_none")]
    pub property_token: Option<String>,
    /// Check-in date (YYYY-MM-DD)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub check_in: Option<String>,
    /// Check-out date (YYYY-MM-DD)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub check_out: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub adults: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub currency: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
}

/// Parameters for [`HotelsSearchParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct HotelsSearchParams {
    /// Location or hotel name
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Check-in date (YYYY-MM-DD)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub check_in: Option<String>,
    /// Check-out date (YYYY-MM-DD)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub check_out: Option<String>,
    /// Number of adults
    #[serde(skip_serializing_if = "Option::is_none")]
    pub adults: Option<i64>,
    /// Number of children
    #[serde(skip_serializing_if = "Option::is_none")]
    pub children: Option<i64>,
    /// Currency code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub currency: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Sort: price_low, rating_high, most_reviewed
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sort_by: Option<String>,
    /// Minimum price
    #[serde(skip_serializing_if = "Option::is_none")]
    pub min_price: Option<i64>,
    /// Maximum price
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_price: Option<i64>,
    /// Star rating
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hotel_class: Option<i64>,
    /// Pagination token
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_page_token: Option<String>,
}

/// Parameters for [`SearchImagesParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct SearchImagesParams {
    /// Image search query
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Time/filter string (e.g. qdr:d)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tbs: Option<String>,
    /// Image size: l=large, m=medium, i=icon, xXl, etc.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub imgsz: Option<String>,
    /// Image color: color, gray, transparent, red, orange, etc.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub imgcolor: Option<String>,
    /// Image type: face, photo, clipart, lineart, animated
    #[serde(skip_serializing_if = "Option::is_none")]
    pub imgtype: Option<String>,
    /// Safe search: off, active
    #[serde(skip_serializing_if = "Option::is_none")]
    pub safe: Option<String>,
    /// Page number (0-based, each page = 20 results)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
}

/// Parameters for [`JobsSearchParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct JobsSearchParams {
    /// Job title / keywords / combined query.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// City / state / region — concatenated with `q` before sending to Google.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub location: Option<String>,
    /// Country code (ISO 3166 alpha-2).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Alias for `gl`; when present overrides it.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub country: Option<String>,
    /// Language code.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Alias for `hl`; when present overrides it.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub language: Option<String>,
    /// Google domain for locale-specific results (`google.com`, `google.co.uk`, `google.co.in`, …).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub domain: Option<String>,
    /// Employment type — translated into a `chips` filter.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub job_type: Option<JobsSearchJobType>,
    /// Posted-date window — translated into a `chips` filter.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub date_posted: Option<JobsSearchDatePosted>,
    /// Work arrangement — maps onto Google's remote/hybrid/onsite chips.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ltype: Option<JobsSearchLtype>,
    /// Raw Google chip-filter string (comma-separated). Merged with any structured filters (`job_type`, `date_posted`, `ltype`).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub chips: Option<String>,
    /// Opaque Google filter token harvested from a prior Jobs search URL.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub uds: Option<String>,
    /// Google's UULE-encoded location (e.g. `w+CAIQIFJlbGF5IFN0YXRlcw==`).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub uule: Option<String>,
    /// Search radius around the location (Google accepts a distance in miles).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lrad: Option<String>,
    /// Opaque token from the previous response's `pagination.next`.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_page_token: Option<String>,
    /// Data source. ``rpc`` (default, ~300 ms) replays Google's own ``r06xKb`` batchexecute RPC on the Google Careers portal — clean JSON, 20 roles per page, scope = Google's internal openings. ``serp`` uses the public Jobs search vertical (``udm=8``, SERP-embedded, 3rd-party aggregator) and costs more latency because Google gates it behind JS.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mode: Option<JobsSearchMode>,
}

/// Parameters for [`SearchLensParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct SearchLensParams {
    /// Public URL of the image to search visually
    #[serde(skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
}

/// Parameters for [`LocalSearchParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct LocalSearchParams {
    /// Search query (e.g. 'pizza in New York')
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Google domain
    #[serde(skip_serializing_if = "Option::is_none")]
    pub domain: Option<String>,
    /// City-level geo-targeting (e.g. 'New York, USA')
    #[serde(skip_serializing_if = "Option::is_none")]
    pub location: Option<String>,
    /// UULE encoded location
    #[serde(skip_serializing_if = "Option::is_none")]
    pub uule: Option<String>,
    /// Results per page
    #[serde(skip_serializing_if = "Option::is_none")]
    pub num: Option<i64>,
    /// Pagination offset
    #[serde(skip_serializing_if = "Option::is_none")]
    pub start: Option<i64>,
}

/// Parameters for [`MapsPhotosParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct MapsPhotosParams {
    /// Google Maps data ID (0x...:0x...)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub data_id: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
}

/// Parameters for [`MapsPlaceParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct MapsPlaceParams {
    /// Google place ID (ChIJ...)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub place_id: Option<String>,
    /// Google Maps data ID (0x...:0x...)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub data_id: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
}

/// Parameters for [`MapsPostsParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct MapsPostsParams {
    /// Google Maps data ID (0x...:0x...) — from /maps/search results
    #[serde(skip_serializing_if = "Option::is_none")]
    pub data_id: Option<String>,
    /// Google place ID (ChIJ...)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub place_id: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
}

/// Parameters for [`MapsReviewsParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct MapsReviewsParams {
    /// Google Maps data ID (0x...:0x...)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub data_id: Option<String>,
    /// Sort order
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sort_by: Option<MapsReviewsSortBy>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Pagination token from previous response
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_page_token: Option<String>,
    /// Review offset (0-based)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub offset: Option<i64>,
    /// Reviews per page
    #[serde(skip_serializing_if = "Option::is_none")]
    pub results: Option<i64>,
}

/// Parameters for [`MapsSearchParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct MapsSearchParams {
    /// Search query (e.g. 'pizza in New York')
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// GPS coords @lat,lng,zoom
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ll: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Pagination offset (increments of 20)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub start: Option<i64>,
}

/// Parameters for [`SearchNewsParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct SearchNewsParams {
    /// Search query
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Maximum articles
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_results: Option<i64>,
}

/// Parameters for [`NewsByTopicParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct NewsByTopicParams {
    /// Topic name
    #[serde(skip_serializing_if = "Option::is_none")]
    pub topic: Option<NewsByTopicTopic>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_results: Option<i64>,
}

/// Parameters for [`TrendingNewsParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct TrendingNewsParams {
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_results: Option<i64>,
}

/// Parameters for [`GetPatentDetailParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct GetPatentDetailParams {
    /// Patent/publication number (e.g. US10000000B2)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub patent_id: Option<String>,
}

/// Parameters for [`SearchPatentsParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct SearchPatentsParams {
    /// Search query (supports Boolean logic)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Page number
    #[serde(skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    /// Results per page
    #[serde(skip_serializing_if = "Option::is_none")]
    pub num: Option<i64>,
    /// Sort order
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sort: Option<SearchPatentsSort>,
    /// Inventor name(s)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub inventor: Option<String>,
    /// Assignee name(s)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub assignee: Option<String>,
    /// Country code(s)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub country: Option<String>,
    /// Patent language
    #[serde(skip_serializing_if = "Option::is_none")]
    pub language: Option<SearchPatentsLanguage>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status: Option<SearchPatentsStatus>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub patent_type: Option<SearchPatentsPatentType>,
    /// Before date (YYYYMMDD)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub before: Option<String>,
    /// After date (YYYYMMDD)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub after: Option<String>,
}

/// Parameters for [`GetProductDetailParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct GetProductDetailParams {
    /// Google Shopping product identifier (``gpcid``). Returned as ``product_id``/``gpcid`` on ``/shopping/search`` tiles.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub product_id: Option<String>,
    /// Original search query that surfaced the product. Required by Google's ``/async/oapv`` RPC — the page-level ``ei``/``xsrf`` and per-tile ``oapvfc`` tokens are extracted from the SERP Google renders for this exact query, so the product must be discoverable via this query.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Country code (ISO 3166 alpha-2). Defaults to the country implied by ``domain`` (e.g. ``google.com.au`` → ``au``), falling back to ``us`` when domain doesn't carry a country hint.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Language code.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Google domain ("google.com" / "google.co.uk" / …) — used to localise the SERP render that produces the session tokens.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub domain: Option<String>,
    /// When true, return the full merchant-offer list with deep product URLs for every merchant Google ships an offer-block for. Offers come from the primary oapv response (top ~5 panel merchants: DICK'S, Kohl's, Zappos, etc.) plus a parallel paginated fan-out of ``/async/oapv`` with ``async_context=MORE_STORES`` at offsets sori=5..60 — which surfaces an additional ~50 sellers including GOAT, eBay sub-sellers, Macy's, StockX, Poshmark, Flight Club, etc. (+5 parallel RPCs, ~1 s wall-clock).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub include_offers: Option<bool>,
    /// When true, also fetch size/colour variants via ``/async/toy_v`` (+1 secondary RPC, ~1 s).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub include_variants: Option<bool>,
    /// When true (only meaningful with ``include_offers=true``), browser-render the Shopping SERP so additional merchant deep URLs surface from the rendered HTML. Best-effort: catalog-feed retailers (DSW / Famous Footwear / Shoe Carnival / Myer / rebel) get deep URLs; paid-Shopping-Ads merchants (Zappos, GOAT, Academy, etc.) still get their homepage because their click-through URLs are signed by Google's aclk redirect and can't be reproduced server-side. Adds ~5–8 s latency.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub resolve_deep_urls: Option<bool>,
}

/// Parameters for [`ScholarAuthorParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ScholarAuthorParams {
    /// Scholar user ID (the `user` query parameter)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub author_id: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Articles pagination offset
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cstart: Option<i64>,
    /// Articles per page
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pagesize: Option<i64>,
}

/// Parameters for [`ScholarAuthorCitationParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ScholarAuthorCitationParams {
    /// Scholar user ID
    #[serde(skip_serializing_if = "Option::is_none")]
    pub author_id: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
}

/// Parameters for [`ScholarCiteParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ScholarCiteParams {
    /// Cluster ID from a search result (e.g. '5Gohgn6QFikJ')
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
}

/// Parameters for [`ScholarProfilesParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ScholarProfilesParams {
    /// Author name query (e.g. 'Geoffrey Hinton')
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mauthors: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Pagination token for the next page
    #[serde(skip_serializing_if = "Option::is_none")]
    pub after_author: Option<String>,
    /// Pagination token for the previous page
    #[serde(skip_serializing_if = "Option::is_none")]
    pub before_author: Option<String>,
}

/// Parameters for [`SearchScholarParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct SearchScholarParams {
    /// Search query for scholarly articles
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Year from (e.g. 2020)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub as_ylo: Option<i64>,
    /// Year to (e.g. 2024)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub as_yhi: Option<i64>,
    /// Search type: 0=exclude patents, 7=include patents
    #[serde(skip_serializing_if = "Option::is_none")]
    pub as_sdt: Option<String>,
    /// Page number (0-based)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    /// Results per page (max 20)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub num: Option<i64>,
}

/// Parameters for [`SearchParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct SearchParams {
    /// Search query (supports Google operators like site:, inurl:, intitle:)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Country code (e.g. us, gb, de, fr)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Language code (e.g. en, es, fr)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Results per page
    #[serde(skip_serializing_if = "Option::is_none")]
    pub num: Option<i64>,
    /// Pagination offset (0, 10, 20...)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub start: Option<i64>,
    /// Google domain (e.g. google.com, google.co.uk)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub domain: Option<String>,
    /// desktop or mobile
    #[serde(skip_serializing_if = "Option::is_none")]
    pub device: Option<String>,
    /// City-level geo-targeting (e.g. 'New York, USA')
    #[serde(skip_serializing_if = "Option::is_none")]
    pub location: Option<String>,
    /// Language restrict (e.g. lang_en)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lr: Option<String>,
    /// Time-based search filter (e.g. qdr:d for past 24h)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tbs: Option<String>,
    /// Safe search (active/off)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub safe: Option<String>,
    /// Encoded location parameter (UULE)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub uule: Option<String>,
    /// Include omitted results (0=show all, 1=filter)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub filter: Option<i64>,
    /// Disable auto-correction (1=exact match)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub nfpr: Option<i64>,
    /// Country restrict (e.g. countryUS|countryGB)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cr: Option<String>,
    /// Google My Business CID (place ID)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ludocid: Option<String>,
    /// Knowledge Graph map view ID
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lsig: Option<String>,
    /// Knowledge Graph entity ID
    #[serde(skip_serializing_if = "Option::is_none")]
    pub kgmid: Option<String>,
    /// Cached search parameters
    #[serde(skip_serializing_if = "Option::is_none")]
    pub si: Option<String>,
    /// Layout control (e.g. gwp;0,7)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ibp: Option<String>,
    /// Google filter string
    #[serde(skip_serializing_if = "Option::is_none")]
    pub uds: Option<String>,
    /// When true, chase Google's deferred AI Overview page_token with a follow-up fetch and merge the result into ai_overview. Adds ~1s and 1 credit when the SERP actually defers the overview.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ai_overview: Option<bool>,
    /// Response mode. **full** (default): complete SERP with all blocks (organic, ads, knowledge graph, local pack, AI overview, news, related questions, etc). **fast**: lite endpoint via `gbv=1` that returns ONLY organic results + related searches in ~0.6-1s cold (vs 1.5-2s full). Use when you only need organic results and can skip rich features.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mode: Option<SearchMode>,
}

/// Parameters for [`ShoppingProductParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ShoppingProductParams {
    /// Product ID from search results
    #[serde(skip_serializing_if = "Option::is_none")]
    pub product_id: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
}

/// Parameters for [`ShoppingProductClickParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ShoppingProductClickParams {
    /// Exact product title from a search result
    #[serde(skip_serializing_if = "Option::is_none")]
    pub title: Option<String>,
    /// Merchant source name from the shopping card (e.g. 'Walmart', 'Best Buy'). Forces the resolved URL to that merchant via site: operator.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub source: Option<String>,
    /// Original search query (optional, improves disambiguation)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Stable product_id from the /shopping/search result
    #[serde(skip_serializing_if = "Option::is_none")]
    pub product_id: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
}

/// Parameters for [`ShoppingSearchParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ShoppingSearchParams {
    /// Product search query
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Minimum price
    #[serde(skip_serializing_if = "Option::is_none")]
    pub min_price: Option<i64>,
    /// Maximum price
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_price: Option<i64>,
    /// Sort: price_low, price_high, rating, reviews
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sort_by: Option<String>,
    /// Free shipping filter
    #[serde(skip_serializing_if = "Option::is_none")]
    pub free_shipping: Option<bool>,
    /// On sale filter
    #[serde(skip_serializing_if = "Option::is_none")]
    pub on_sale: Option<bool>,
    /// Pagination offset
    #[serde(skip_serializing_if = "Option::is_none")]
    pub start: Option<i64>,
}

/// Parameters for [`ShortsSearchParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct ShortsSearchParams {
    /// Search query
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Google domain
    #[serde(skip_serializing_if = "Option::is_none")]
    pub domain: Option<String>,
    /// Results per page
    #[serde(skip_serializing_if = "Option::is_none")]
    pub num: Option<i64>,
    /// Pagination offset
    #[serde(skip_serializing_if = "Option::is_none")]
    pub start: Option<i64>,
}

/// Parameters for [`TrendsAutocompleteParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct TrendsAutocompleteParams {
    /// Query prefix to resolve into Trends topics
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Timezone offset in minutes (Google format)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tz: Option<String>,
}

/// Parameters for [`TrendsInterestParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct TrendsInterestParams {
    /// Search term(s), comma-separated (max 5)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Geographic location (e.g. US, GB)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub geo: Option<String>,
    /// Time range (e.g. 'now 1-H', 'today 12-m', 'all', or 'YYYY-MM-DD YYYY-MM-DD')
    #[serde(skip_serializing_if = "Option::is_none")]
    pub date: Option<String>,
    /// Category filter (0 = all)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub category: Option<i64>,
    /// Property: web, images, news, froogle, youtube
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gprop: Option<String>,
}

/// Parameters for [`TrendsRegionsParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct TrendsRegionsParams {
    /// Search term
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Geographic location
    #[serde(skip_serializing_if = "Option::is_none")]
    pub geo: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub date: Option<String>,
    /// Region granularity. `auto` (default) uses Google's widget default, which is `COUNTRY` for worldwide queries and `REGION` (state/province) for single-country queries. Overriding to `COUNTRY` when `geo` is set returns HTTP 400 from Google — use `REGION`, `DMA`, or `CITY` in that case.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub resolution: Option<TrendsRegionsResolution>,
}

/// Parameters for [`TrendsRelatedParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct TrendsRelatedParams {
    /// Search term
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub geo: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub date: Option<String>,
}

/// Parameters for [`TrendsSearchParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct TrendsSearchParams {
    /// Search term(s). Up to 5 comma-separated terms for TIMESERIES / GEO_MAP; single term for GEO_MAP_0 / RELATED_TOPICS / RELATED_QUERIES. Also accepts a topic MID.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Dispatch on: TIMESERIES (interest over time), GEO_MAP (compared breakdown, multi-query), GEO_MAP_0 (interest by region, single query), RELATED_TOPICS (top + rising topics), RELATED_QUERIES (top + rising queries).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub data_type: Option<TrendsSearchDataType>,
    /// Country / region code (e.g. US, GB, US-CA).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub geo: Option<String>,
    /// Time range.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub date: Option<String>,
    /// Category filter ID (0 = all).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cat: Option<i64>,
    /// Property filter: "" (web), "images", "news", "froogle", "youtube".
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gprop: Option<String>,
    /// Geo resolution for GEO_MAP / GEO_MAP_0: COUNTRY / REGION / DMA / CITY. Omit to use the widget's own default.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub region: Option<String>,
    /// Alias for `hl`. Defaults to en-US.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub language: Option<String>,
    /// Timezone offset in minutes.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tz: Option<String>,
}

/// Parameters for [`TrendsTrendingParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct TrendsTrendingParams {
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub geo: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Hours-back window for the trending list. Google supports 24, 48, 168 (= 1 week).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hours: Option<i64>,
}

/// Parameters for [`TrendsTrendingNowParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct TrendsTrendingNowParams {
    /// Country code (e.g. ``US``, ``LT``, ``GB``).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub geo: Option<String>,
    /// Look-back window in hours. Google's UI supports 4, 24, 48, 168. Passed through to the upstream feed; the public RSS currently ignores this filter.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hours: Option<i64>,
    /// Category filter. Accepts Google's letter codes (``b`` business, ``e`` entertainment, ``m`` health, ``t`` sci/tech, ``s`` sports, ``h`` top stories) or the friendly aliases (``business``, ``entertainment``, ``health``, ``sci_tech``/``technology``, ``sports``, ``top_stories``). ``all`` (default) returns every category.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub category: Option<String>,
    /// Trend state. ``active`` keeps only entries with a non-zero search volume (still surging); ``all`` (default) returns every entry including ended ones.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status: Option<TrendsTrendingNowStatus>,
    /// Sort order. ``relevance`` (default) keeps Google's ordering; ``search_volume`` orders by parsed traffic descending; ``title`` sorts alphabetically; ``recency`` falls back to relevance when the feed omits publication timestamps.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sort: Option<TrendsTrendingNowSort>,
    /// Language code.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
}

/// Parameters for [`SearchVideosParams`]. All fields optional; required ones are noted per method.
#[derive(Debug, Clone, Default, Serialize)]
pub struct SearchVideosParams {
    /// Video search query
    #[serde(skip_serializing_if = "Option::is_none")]
    pub q: Option<String>,
    /// Country code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gl: Option<String>,
    /// Language code
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hl: Option<String>,
    /// Time filter (e.g. qdr:d=past day, qdr:w=past week, qdr:m=past month)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tbs: Option<String>,
    /// Safe search: off, active
    #[serde(skip_serializing_if = "Option::is_none")]
    pub safe: Option<String>,
    /// Page number (0-based, each page = 10 results)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
}