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
// This file is @generated by prost-build.
/// Encodes the detailed information of a barcode.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Barcode {
/// Format of a barcode.
/// The supported formats are:
///
/// - `CODE_128`: Code 128 type.
/// - `CODE_39`: Code 39 type.
/// - `CODE_93`: Code 93 type.
/// - `CODABAR`: Codabar type.
/// - `DATA_MATRIX`: 2D Data Matrix type.
/// - `ITF`: ITF type.
/// - `EAN_13`: EAN-13 type.
/// - `EAN_8`: EAN-8 type.
/// - `QR_CODE`: 2D QR code type.
/// - `UPC_A`: UPC-A type.
/// - `UPC_E`: UPC-E type.
/// - `PDF417`: PDF417 type.
/// - `AZTEC`: 2D Aztec code type.
/// - `DATABAR`: GS1 DataBar code type.
#[prost(string, tag = "1")]
pub format: ::prost::alloc::string::String,
/// Value format describes the format of the value that a barcode
/// encodes.
/// The supported formats are:
///
/// - `CONTACT_INFO`: Contact information.
/// - `EMAIL`: Email address.
/// - `ISBN`: ISBN identifier.
/// - `PHONE`: Phone number.
/// - `PRODUCT`: Product.
/// - `SMS`: SMS message.
/// - `TEXT`: Text string.
/// - `URL`: URL address.
/// - `WIFI`: Wifi information.
/// - `GEO`: Geo-localization.
/// - `CALENDAR_EVENT`: Calendar event.
/// - `DRIVER_LICENSE`: Driver's license.
#[prost(string, tag = "2")]
pub value_format: ::prost::alloc::string::String,
/// Raw value encoded in the barcode.
/// For example: `'MEBKM:TITLE:Google;URL:<https://www.google.com;;'`.>
#[prost(string, tag = "3")]
pub raw_value: ::prost::alloc::string::String,
}
/// A vertex represents a 2D point in the image.
/// NOTE: the vertex coordinates are in the same scale as the original image.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Vertex {
/// X coordinate.
#[prost(int32, tag = "1")]
pub x: i32,
/// Y coordinate (starts from the top of the image).
#[prost(int32, tag = "2")]
pub y: i32,
}
/// A vertex represents a 2D point in the image.
/// NOTE: the normalized vertex coordinates are relative to the original image
/// and range from 0 to 1.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct NormalizedVertex {
/// X coordinate.
#[prost(float, tag = "1")]
pub x: f32,
/// Y coordinate (starts from the top of the image).
#[prost(float, tag = "2")]
pub y: f32,
}
/// A bounding polygon for the detected image annotation.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BoundingPoly {
/// The bounding polygon vertices.
#[prost(message, repeated, tag = "1")]
pub vertices: ::prost::alloc::vec::Vec<Vertex>,
/// The bounding polygon normalized vertices.
#[prost(message, repeated, tag = "2")]
pub normalized_vertices: ::prost::alloc::vec::Vec<NormalizedVertex>,
}
/// Document represents the canonical document resource in Document AI. It is an
/// interchange format that provides insights into documents and allows for
/// collaboration between users and Document AI to iterate and optimize for
/// quality.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Document {
/// An IANA published [media type (MIME
/// type)](<https://www.iana.org/assignments/media-types/media-types.xhtml>).
#[prost(string, tag = "3")]
pub mime_type: ::prost::alloc::string::String,
/// Optional. UTF-8 encoded text in reading order from the document.
#[prost(string, tag = "4")]
pub text: ::prost::alloc::string::String,
/// Styles for the [Document.text][google.cloud.documentai.v1.Document.text].
#[deprecated]
#[prost(message, repeated, tag = "5")]
pub text_styles: ::prost::alloc::vec::Vec<document::Style>,
/// Visual page layout for the [Document][google.cloud.documentai.v1.Document].
#[prost(message, repeated, tag = "6")]
pub pages: ::prost::alloc::vec::Vec<document::Page>,
/// A list of entities detected on
/// [Document.text][google.cloud.documentai.v1.Document.text]. For document
/// shards, entities in this list may cross shard boundaries.
#[prost(message, repeated, tag = "7")]
pub entities: ::prost::alloc::vec::Vec<document::Entity>,
/// Placeholder. Relationship among
/// [Document.entities][google.cloud.documentai.v1.Document.entities].
#[prost(message, repeated, tag = "8")]
pub entity_relations: ::prost::alloc::vec::Vec<document::EntityRelation>,
/// Placeholder. A list of text corrections made to
/// [Document.text][google.cloud.documentai.v1.Document.text]. This is usually
/// used for annotating corrections to OCR mistakes. Text changes for a given
/// revision may not overlap with each other.
#[prost(message, repeated, tag = "14")]
pub text_changes: ::prost::alloc::vec::Vec<document::TextChange>,
/// Information about the sharding if this document is sharded part of a larger
/// document. If the document is not sharded, this message is not specified.
#[prost(message, optional, tag = "9")]
pub shard_info: ::core::option::Option<document::ShardInfo>,
/// Any error that occurred while processing this document.
#[prost(message, optional, tag = "10")]
pub error: ::core::option::Option<super::super::super::rpc::Status>,
/// Placeholder. Revision history of this document.
#[prost(message, repeated, tag = "13")]
pub revisions: ::prost::alloc::vec::Vec<document::Revision>,
/// Parsed layout of the document.
#[prost(message, optional, tag = "17")]
pub document_layout: ::core::option::Option<document::DocumentLayout>,
/// Document chunked based on chunking config.
#[prost(message, optional, tag = "18")]
pub chunked_document: ::core::option::Option<document::ChunkedDocument>,
/// Original source document from the user.
#[prost(oneof = "document::Source", tags = "1, 2")]
pub source: ::core::option::Option<document::Source>,
}
/// Nested message and enum types in `Document`.
pub mod document {
/// For a large document, sharding may be performed to produce several
/// document shards. Each document shard contains this field to detail which
/// shard it is.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ShardInfo {
/// The 0-based index of this shard.
#[prost(int64, tag = "1")]
pub shard_index: i64,
/// Total number of shards.
#[prost(int64, tag = "2")]
pub shard_count: i64,
/// The index of the first character in
/// [Document.text][google.cloud.documentai.v1.Document.text] in the overall
/// document global text.
#[prost(int64, tag = "3")]
pub text_offset: i64,
}
/// Annotation for common text style attributes. This adheres to CSS
/// conventions as much as possible.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Style {
/// Text anchor indexing into the
/// [Document.text][google.cloud.documentai.v1.Document.text].
#[prost(message, optional, tag = "1")]
pub text_anchor: ::core::option::Option<TextAnchor>,
/// Text color.
#[prost(message, optional, tag = "2")]
pub color: ::core::option::Option<super::super::super::super::r#type::Color>,
/// Text background color.
#[prost(message, optional, tag = "3")]
pub background_color: ::core::option::Option<
super::super::super::super::r#type::Color,
>,
/// [Font weight](<https://www.w3schools.com/cssref/pr_font_weight.asp>).
/// Possible values are `normal`, `bold`, `bolder`, and `lighter`.
#[prost(string, tag = "4")]
pub font_weight: ::prost::alloc::string::String,
/// [Text style](<https://www.w3schools.com/cssref/pr_font_font-style.asp>).
/// Possible values are `normal`, `italic`, and `oblique`.
#[prost(string, tag = "5")]
pub text_style: ::prost::alloc::string::String,
/// [Text
/// decoration](<https://www.w3schools.com/cssref/pr_text_text-decoration.asp>).
/// Follows CSS standard. <text-decoration-line> <text-decoration-color>
/// <text-decoration-style>
#[prost(string, tag = "6")]
pub text_decoration: ::prost::alloc::string::String,
/// Font size.
#[prost(message, optional, tag = "7")]
pub font_size: ::core::option::Option<style::FontSize>,
/// Font family such as `Arial`, `Times New Roman`.
/// <https://www.w3schools.com/cssref/pr_font_font-family.asp>
#[prost(string, tag = "8")]
pub font_family: ::prost::alloc::string::String,
}
/// Nested message and enum types in `Style`.
pub mod style {
/// Font size with unit.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FontSize {
/// Font size for the text.
#[prost(float, tag = "1")]
pub size: f32,
/// Unit for the font size. Follows CSS naming (such as `in`, `px`, and
/// `pt`).
#[prost(string, tag = "2")]
pub unit: ::prost::alloc::string::String,
}
}
/// A page in a [Document][google.cloud.documentai.v1.Document].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Page {
/// 1-based index for current
/// [Page][google.cloud.documentai.v1.Document.Page] in a parent
/// [Document][google.cloud.documentai.v1.Document]. Useful when a page is
/// taken out of a [Document][google.cloud.documentai.v1.Document] for
/// individual processing.
#[prost(int32, tag = "1")]
pub page_number: i32,
/// Rendered image for this page. This image is preprocessed to remove any
/// skew, rotation, and distortions such that the annotation bounding boxes
/// can be upright and axis-aligned.
#[prost(message, optional, tag = "13")]
pub image: ::core::option::Option<page::Image>,
/// Transformation matrices that were applied to the original document image
/// to produce [Page.image][google.cloud.documentai.v1.Document.Page.image].
#[prost(message, repeated, tag = "14")]
pub transforms: ::prost::alloc::vec::Vec<page::Matrix>,
/// Physical dimension of the page.
#[prost(message, optional, tag = "2")]
pub dimension: ::core::option::Option<page::Dimension>,
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page.
#[prost(message, optional, tag = "3")]
pub layout: ::core::option::Option<page::Layout>,
/// A list of detected languages together with confidence.
#[prost(message, repeated, tag = "4")]
pub detected_languages: ::prost::alloc::vec::Vec<page::DetectedLanguage>,
/// A list of visually detected text blocks on the page.
/// A block has a set of lines (collected into paragraphs) that have a common
/// line-spacing and orientation.
#[prost(message, repeated, tag = "5")]
pub blocks: ::prost::alloc::vec::Vec<page::Block>,
/// A list of visually detected text paragraphs on the page.
/// A collection of lines that a human would perceive as a paragraph.
#[prost(message, repeated, tag = "6")]
pub paragraphs: ::prost::alloc::vec::Vec<page::Paragraph>,
/// A list of visually detected text lines on the page.
/// A collection of tokens that a human would perceive as a line.
#[prost(message, repeated, tag = "7")]
pub lines: ::prost::alloc::vec::Vec<page::Line>,
/// A list of visually detected tokens on the page.
#[prost(message, repeated, tag = "8")]
pub tokens: ::prost::alloc::vec::Vec<page::Token>,
/// A list of detected non-text visual elements e.g. checkbox,
/// signature etc. on the page.
#[prost(message, repeated, tag = "9")]
pub visual_elements: ::prost::alloc::vec::Vec<page::VisualElement>,
/// A list of visually detected tables on the page.
#[prost(message, repeated, tag = "10")]
pub tables: ::prost::alloc::vec::Vec<page::Table>,
/// A list of visually detected form fields on the page.
#[prost(message, repeated, tag = "11")]
pub form_fields: ::prost::alloc::vec::Vec<page::FormField>,
/// A list of visually detected symbols on the page.
#[prost(message, repeated, tag = "12")]
pub symbols: ::prost::alloc::vec::Vec<page::Symbol>,
/// A list of detected barcodes.
#[prost(message, repeated, tag = "15")]
pub detected_barcodes: ::prost::alloc::vec::Vec<page::DetectedBarcode>,
/// Image quality scores.
#[prost(message, optional, tag = "17")]
pub image_quality_scores: ::core::option::Option<page::ImageQualityScores>,
/// The history of this page.
#[deprecated]
#[prost(message, optional, tag = "16")]
pub provenance: ::core::option::Option<Provenance>,
}
/// Nested message and enum types in `Page`.
pub mod page {
/// Dimension for the page.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Dimension {
/// Page width.
#[prost(float, tag = "1")]
pub width: f32,
/// Page height.
#[prost(float, tag = "2")]
pub height: f32,
/// Dimension unit.
#[prost(string, tag = "3")]
pub unit: ::prost::alloc::string::String,
}
/// Rendered image contents for this page.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Image {
/// Raw byte content of the image.
#[prost(bytes = "bytes", tag = "1")]
pub content: ::prost::bytes::Bytes,
/// Encoding [media type (MIME
/// type)](<https://www.iana.org/assignments/media-types/media-types.xhtml>)
/// for the image.
#[prost(string, tag = "2")]
pub mime_type: ::prost::alloc::string::String,
/// Width of the image in pixels.
#[prost(int32, tag = "3")]
pub width: i32,
/// Height of the image in pixels.
#[prost(int32, tag = "4")]
pub height: i32,
}
/// Representation for transformation matrix, intended to be compatible and
/// used with OpenCV format for image manipulation.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Matrix {
/// Number of rows in the matrix.
#[prost(int32, tag = "1")]
pub rows: i32,
/// Number of columns in the matrix.
#[prost(int32, tag = "2")]
pub cols: i32,
/// This encodes information about what data type the matrix uses.
/// For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list
/// of OpenCV primitive data types, please refer to
/// <https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html>
#[prost(int32, tag = "3")]
pub r#type: i32,
/// The matrix data.
#[prost(bytes = "bytes", tag = "4")]
pub data: ::prost::bytes::Bytes,
}
/// Visual element describing a layout unit on a page.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Layout {
/// Text anchor indexing into the
/// [Document.text][google.cloud.documentai.v1.Document.text].
#[prost(message, optional, tag = "1")]
pub text_anchor: ::core::option::Option<super::TextAnchor>,
/// Confidence of the current
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout] within
/// context of the object this layout is for. e.g. confidence can be for a
/// single token, a table, a visual element, etc. depending on context.
/// Range `\[0, 1\]`.
#[prost(float, tag = "2")]
pub confidence: f32,
/// The bounding polygon for the
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
#[prost(message, optional, tag = "3")]
pub bounding_poly: ::core::option::Option<super::super::BoundingPoly>,
/// Detected orientation for the
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
#[prost(enumeration = "layout::Orientation", tag = "4")]
pub orientation: i32,
}
/// Nested message and enum types in `Layout`.
pub mod layout {
/// Detected human reading orientation.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Orientation {
/// Unspecified orientation.
Unspecified = 0,
/// Orientation is aligned with page up.
PageUp = 1,
/// Orientation is aligned with page right.
/// Turn the head 90 degrees clockwise from upright to read.
PageRight = 2,
/// Orientation is aligned with page down.
/// Turn the head 180 degrees from upright to read.
PageDown = 3,
/// Orientation is aligned with page left.
/// Turn the head 90 degrees counterclockwise from upright to read.
PageLeft = 4,
}
impl Orientation {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Orientation::Unspecified => "ORIENTATION_UNSPECIFIED",
Orientation::PageUp => "PAGE_UP",
Orientation::PageRight => "PAGE_RIGHT",
Orientation::PageDown => "PAGE_DOWN",
Orientation::PageLeft => "PAGE_LEFT",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ORIENTATION_UNSPECIFIED" => Some(Self::Unspecified),
"PAGE_UP" => Some(Self::PageUp),
"PAGE_RIGHT" => Some(Self::PageRight),
"PAGE_DOWN" => Some(Self::PageDown),
"PAGE_LEFT" => Some(Self::PageLeft),
_ => None,
}
}
}
}
/// A block has a set of lines (collected into paragraphs) that have a
/// common line-spacing and orientation.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Block {
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
/// [Block][google.cloud.documentai.v1.Document.Page.Block].
#[prost(message, optional, tag = "1")]
pub layout: ::core::option::Option<Layout>,
/// A list of detected languages together with confidence.
#[prost(message, repeated, tag = "2")]
pub detected_languages: ::prost::alloc::vec::Vec<DetectedLanguage>,
/// The history of this annotation.
#[deprecated]
#[prost(message, optional, tag = "3")]
pub provenance: ::core::option::Option<super::Provenance>,
}
/// A collection of lines that a human would perceive as a paragraph.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Paragraph {
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
/// [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph].
#[prost(message, optional, tag = "1")]
pub layout: ::core::option::Option<Layout>,
/// A list of detected languages together with confidence.
#[prost(message, repeated, tag = "2")]
pub detected_languages: ::prost::alloc::vec::Vec<DetectedLanguage>,
/// The history of this annotation.
#[deprecated]
#[prost(message, optional, tag = "3")]
pub provenance: ::core::option::Option<super::Provenance>,
}
/// A collection of tokens that a human would perceive as a line.
/// Does not cross column boundaries, can be horizontal, vertical, etc.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Line {
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
/// [Line][google.cloud.documentai.v1.Document.Page.Line].
#[prost(message, optional, tag = "1")]
pub layout: ::core::option::Option<Layout>,
/// A list of detected languages together with confidence.
#[prost(message, repeated, tag = "2")]
pub detected_languages: ::prost::alloc::vec::Vec<DetectedLanguage>,
/// The history of this annotation.
#[deprecated]
#[prost(message, optional, tag = "3")]
pub provenance: ::core::option::Option<super::Provenance>,
}
/// A detected token.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Token {
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
/// [Token][google.cloud.documentai.v1.Document.Page.Token].
#[prost(message, optional, tag = "1")]
pub layout: ::core::option::Option<Layout>,
/// Detected break at the end of a
/// [Token][google.cloud.documentai.v1.Document.Page.Token].
#[prost(message, optional, tag = "2")]
pub detected_break: ::core::option::Option<token::DetectedBreak>,
/// A list of detected languages together with confidence.
#[prost(message, repeated, tag = "3")]
pub detected_languages: ::prost::alloc::vec::Vec<DetectedLanguage>,
/// The history of this annotation.
#[deprecated]
#[prost(message, optional, tag = "4")]
pub provenance: ::core::option::Option<super::Provenance>,
/// Text style attributes.
#[prost(message, optional, tag = "5")]
pub style_info: ::core::option::Option<token::StyleInfo>,
}
/// Nested message and enum types in `Token`.
pub mod token {
/// Detected break at the end of a
/// [Token][google.cloud.documentai.v1.Document.Page.Token].
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DetectedBreak {
/// Detected break type.
#[prost(enumeration = "detected_break::Type", tag = "1")]
pub r#type: i32,
}
/// Nested message and enum types in `DetectedBreak`.
pub mod detected_break {
/// Enum to denote the type of break found.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Type {
/// Unspecified break type.
Unspecified = 0,
/// A single whitespace.
Space = 1,
/// A wider whitespace.
WideSpace = 2,
/// A hyphen that indicates that a token has been split across lines.
Hyphen = 3,
}
impl Type {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Type::Unspecified => "TYPE_UNSPECIFIED",
Type::Space => "SPACE",
Type::WideSpace => "WIDE_SPACE",
Type::Hyphen => "HYPHEN",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"SPACE" => Some(Self::Space),
"WIDE_SPACE" => Some(Self::WideSpace),
"HYPHEN" => Some(Self::Hyphen),
_ => None,
}
}
}
}
/// Font and other text style attributes.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StyleInfo {
/// Font size in points (`1` point is `¹⁄₇₂` inches).
#[prost(int32, tag = "1")]
pub font_size: i32,
/// Font size in pixels, equal to _unrounded
/// [font_size][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]_
/// * _resolution_ ÷ `72.0`.
#[prost(double, tag = "2")]
pub pixel_font_size: f64,
/// Letter spacing in points.
#[prost(double, tag = "3")]
pub letter_spacing: f64,
/// Name or style of the font.
#[prost(string, tag = "4")]
pub font_type: ::prost::alloc::string::String,
/// Whether the text is bold (equivalent to
/// [font_weight][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]
/// is at least `700`).
#[prost(bool, tag = "5")]
pub bold: bool,
/// Whether the text is italic.
#[prost(bool, tag = "6")]
pub italic: bool,
/// Whether the text is underlined.
#[prost(bool, tag = "7")]
pub underlined: bool,
/// Whether the text is strikethrough. This feature is not supported yet.
#[prost(bool, tag = "8")]
pub strikeout: bool,
/// Whether the text is a subscript. This feature is not supported yet.
#[prost(bool, tag = "9")]
pub subscript: bool,
/// Whether the text is a superscript. This feature is not supported yet.
#[prost(bool, tag = "10")]
pub superscript: bool,
/// Whether the text is in small caps. This feature is not supported yet.
#[prost(bool, tag = "11")]
pub smallcaps: bool,
/// TrueType weight on a scale `100` (thin) to `1000` (ultra-heavy).
/// Normal is `400`, bold is `700`.
#[prost(int32, tag = "12")]
pub font_weight: i32,
/// Whether the text is handwritten.
#[prost(bool, tag = "13")]
pub handwritten: bool,
/// Color of the text.
#[prost(message, optional, tag = "14")]
pub text_color: ::core::option::Option<
super::super::super::super::super::super::r#type::Color,
>,
/// Color of the background.
#[prost(message, optional, tag = "15")]
pub background_color: ::core::option::Option<
super::super::super::super::super::super::r#type::Color,
>,
}
}
/// A detected symbol.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Symbol {
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
/// [Symbol][google.cloud.documentai.v1.Document.Page.Symbol].
#[prost(message, optional, tag = "1")]
pub layout: ::core::option::Option<Layout>,
/// A list of detected languages together with confidence.
#[prost(message, repeated, tag = "2")]
pub detected_languages: ::prost::alloc::vec::Vec<DetectedLanguage>,
}
/// Detected non-text visual elements e.g. checkbox, signature etc. on the
/// page.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VisualElement {
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
/// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
#[prost(message, optional, tag = "1")]
pub layout: ::core::option::Option<Layout>,
/// Type of the
/// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
#[prost(string, tag = "2")]
pub r#type: ::prost::alloc::string::String,
/// A list of detected languages together with confidence.
#[prost(message, repeated, tag = "3")]
pub detected_languages: ::prost::alloc::vec::Vec<DetectedLanguage>,
}
/// A table representation similar to HTML table structure.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Table {
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
/// [Table][google.cloud.documentai.v1.Document.Page.Table].
#[prost(message, optional, tag = "1")]
pub layout: ::core::option::Option<Layout>,
/// Header rows of the table.
#[prost(message, repeated, tag = "2")]
pub header_rows: ::prost::alloc::vec::Vec<table::TableRow>,
/// Body rows of the table.
#[prost(message, repeated, tag = "3")]
pub body_rows: ::prost::alloc::vec::Vec<table::TableRow>,
/// A list of detected languages together with confidence.
#[prost(message, repeated, tag = "4")]
pub detected_languages: ::prost::alloc::vec::Vec<DetectedLanguage>,
/// The history of this table.
#[deprecated]
#[prost(message, optional, tag = "5")]
pub provenance: ::core::option::Option<super::Provenance>,
}
/// Nested message and enum types in `Table`.
pub mod table {
/// A row of table cells.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TableRow {
/// Cells that make up this row.
#[prost(message, repeated, tag = "1")]
pub cells: ::prost::alloc::vec::Vec<TableCell>,
}
/// A cell representation inside the table.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TableCell {
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
/// [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell].
#[prost(message, optional, tag = "1")]
pub layout: ::core::option::Option<super::Layout>,
/// How many rows this cell spans.
#[prost(int32, tag = "2")]
pub row_span: i32,
/// How many columns this cell spans.
#[prost(int32, tag = "3")]
pub col_span: i32,
/// A list of detected languages together with confidence.
#[prost(message, repeated, tag = "4")]
pub detected_languages: ::prost::alloc::vec::Vec<
super::DetectedLanguage,
>,
}
}
/// A form field detected on the page.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FormField {
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
/// [FormField][google.cloud.documentai.v1.Document.Page.FormField] name.
/// e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc.
#[prost(message, optional, tag = "1")]
pub field_name: ::core::option::Option<Layout>,
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
/// [FormField][google.cloud.documentai.v1.Document.Page.FormField] value.
#[prost(message, optional, tag = "2")]
pub field_value: ::core::option::Option<Layout>,
/// A list of detected languages for name together with confidence.
#[prost(message, repeated, tag = "3")]
pub name_detected_languages: ::prost::alloc::vec::Vec<DetectedLanguage>,
/// A list of detected languages for value together with confidence.
#[prost(message, repeated, tag = "4")]
pub value_detected_languages: ::prost::alloc::vec::Vec<DetectedLanguage>,
/// If the value is non-textual, this field represents the type. Current
/// valid values are:
///
/// - blank (this indicates the `field_value` is normal text)
/// - `unfilled_checkbox`
/// - `filled_checkbox`
#[prost(string, tag = "5")]
pub value_type: ::prost::alloc::string::String,
/// Created for Labeling UI to export key text.
/// If corrections were made to the text identified by the
/// `field_name.text_anchor`, this field will contain the correction.
#[prost(string, tag = "6")]
pub corrected_key_text: ::prost::alloc::string::String,
/// Created for Labeling UI to export value text.
/// If corrections were made to the text identified by the
/// `field_value.text_anchor`, this field will contain the correction.
#[prost(string, tag = "7")]
pub corrected_value_text: ::prost::alloc::string::String,
/// The history of this annotation.
#[prost(message, optional, tag = "8")]
pub provenance: ::core::option::Option<super::Provenance>,
}
/// A detected barcode.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DetectedBarcode {
/// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
/// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
#[prost(message, optional, tag = "1")]
pub layout: ::core::option::Option<Layout>,
/// Detailed barcode information of the
/// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
#[prost(message, optional, tag = "2")]
pub barcode: ::core::option::Option<super::super::Barcode>,
}
/// Detected language for a structural component.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DetectedLanguage {
/// The [BCP-47 language
/// code](<https://www.unicode.org/reports/tr35/#Unicode_locale_identifier>),
/// such as `en-US` or `sr-Latn`.
#[prost(string, tag = "1")]
pub language_code: ::prost::alloc::string::String,
/// Confidence of detected language. Range `\[0, 1\]`.
#[prost(float, tag = "2")]
pub confidence: f32,
}
/// Image quality scores for the page image.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImageQualityScores {
/// The overall quality score. Range `\[0, 1\]` where `1` is perfect quality.
#[prost(float, tag = "1")]
pub quality_score: f32,
/// A list of detected defects.
#[prost(message, repeated, tag = "2")]
pub detected_defects: ::prost::alloc::vec::Vec<
image_quality_scores::DetectedDefect,
>,
}
/// Nested message and enum types in `ImageQualityScores`.
pub mod image_quality_scores {
/// Image Quality Defects
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DetectedDefect {
/// Name of the defect type. Supported values are:
///
/// - `quality/defect_blurry`
/// - `quality/defect_noisy`
/// - `quality/defect_dark`
/// - `quality/defect_faint`
/// - `quality/defect_text_too_small`
/// - `quality/defect_document_cutoff`
/// - `quality/defect_text_cutoff`
/// - `quality/defect_glare`
#[prost(string, tag = "1")]
pub r#type: ::prost::alloc::string::String,
/// Confidence of detected defect. Range `\[0, 1\]` where `1` indicates
/// strong confidence that the defect exists.
#[prost(float, tag = "2")]
pub confidence: f32,
}
}
}
/// An entity that could be a phrase in the text or a property that belongs to
/// the document. It is a known entity type, such as a person, an organization,
/// or location.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Entity {
/// Optional. Provenance of the entity.
/// Text anchor indexing into the
/// [Document.text][google.cloud.documentai.v1.Document.text].
#[prost(message, optional, tag = "1")]
pub text_anchor: ::core::option::Option<TextAnchor>,
/// Required. Entity type from a schema e.g. `Address`.
#[prost(string, tag = "2")]
pub r#type: ::prost::alloc::string::String,
/// Optional. Text value of the entity e.g. `1600 Amphitheatre Pkwy`.
#[prost(string, tag = "3")]
pub mention_text: ::prost::alloc::string::String,
/// Optional. Deprecated. Use `id` field instead.
#[prost(string, tag = "4")]
pub mention_id: ::prost::alloc::string::String,
/// Optional. Confidence of detected Schema entity. Range `\[0, 1\]`.
#[prost(float, tag = "5")]
pub confidence: f32,
/// Optional. Represents the provenance of this entity wrt. the location on
/// the page where it was found.
#[prost(message, optional, tag = "6")]
pub page_anchor: ::core::option::Option<PageAnchor>,
/// Optional. Canonical id. This will be a unique value in the entity list
/// for this document.
#[prost(string, tag = "7")]
pub id: ::prost::alloc::string::String,
/// Optional. Normalized entity value. Absent if the extracted value could
/// not be converted or the type (e.g. address) is not supported for certain
/// parsers. This field is also only populated for certain supported document
/// types.
#[prost(message, optional, tag = "9")]
pub normalized_value: ::core::option::Option<entity::NormalizedValue>,
/// Optional. Entities can be nested to form a hierarchical data structure
/// representing the content in the document.
#[prost(message, repeated, tag = "10")]
pub properties: ::prost::alloc::vec::Vec<Entity>,
/// Optional. The history of this annotation.
#[prost(message, optional, tag = "11")]
pub provenance: ::core::option::Option<Provenance>,
/// Optional. Whether the entity will be redacted for de-identification
/// purposes.
#[prost(bool, tag = "12")]
pub redacted: bool,
}
/// Nested message and enum types in `Entity`.
pub mod entity {
/// Parsed and normalized entity value.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NormalizedValue {
/// Optional. An optional field to store a normalized string.
/// For some entity types, one of respective `structured_value` fields may
/// also be populated. Also not all the types of `structured_value` will be
/// normalized. For example, some processors may not generate `float`
/// or `integer` normalized text by default.
///
/// Below are sample formats mapped to structured values.
///
/// - Money/Currency type (`money_value`) is in the ISO 4217 text format.
/// - Date type (`date_value`) is in the ISO 8601 text format.
/// - Datetime type (`datetime_value`) is in the ISO 8601 text format.
#[prost(string, tag = "1")]
pub text: ::prost::alloc::string::String,
/// An optional structured entity value.
/// Must match entity type defined in schema if
/// known. If this field is present, the `text` field could also be
/// populated.
#[prost(
oneof = "normalized_value::StructuredValue",
tags = "2, 3, 4, 5, 6, 7, 8"
)]
pub structured_value: ::core::option::Option<
normalized_value::StructuredValue,
>,
}
/// Nested message and enum types in `NormalizedValue`.
pub mod normalized_value {
/// An optional structured entity value.
/// Must match entity type defined in schema if
/// known. If this field is present, the `text` field could also be
/// populated.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum StructuredValue {
/// Money value. See also:
/// <https://github.com/googleapis/googleapis/blob/master/google/type/money.proto>
#[prost(message, tag = "2")]
MoneyValue(super::super::super::super::super::super::r#type::Money),
/// Date value. Includes year, month, day. See also:
/// <https://github.com/googleapis/googleapis/blob/master/google/type/date.proto>
#[prost(message, tag = "3")]
DateValue(super::super::super::super::super::super::r#type::Date),
/// DateTime value. Includes date, time, and timezone. See also:
/// <https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto>
#[prost(message, tag = "4")]
DatetimeValue(
super::super::super::super::super::super::r#type::DateTime,
),
/// Postal address. See also:
/// <https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto>
#[prost(message, tag = "5")]
AddressValue(
super::super::super::super::super::super::r#type::PostalAddress,
),
/// Boolean value. Can be used for entities with binary values, or for
/// checkboxes.
#[prost(bool, tag = "6")]
BooleanValue(bool),
/// Integer value.
#[prost(int32, tag = "7")]
IntegerValue(i32),
/// Float value.
#[prost(float, tag = "8")]
FloatValue(f32),
}
}
}
/// Relationship between
/// [Entities][google.cloud.documentai.v1.Document.Entity].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EntityRelation {
/// Subject entity id.
#[prost(string, tag = "1")]
pub subject_id: ::prost::alloc::string::String,
/// Object entity id.
#[prost(string, tag = "2")]
pub object_id: ::prost::alloc::string::String,
/// Relationship description.
#[prost(string, tag = "3")]
pub relation: ::prost::alloc::string::String,
}
/// Text reference indexing into the
/// [Document.text][google.cloud.documentai.v1.Document.text].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextAnchor {
/// The text segments from the
/// [Document.text][google.cloud.documentai.v1.Document.text].
#[prost(message, repeated, tag = "1")]
pub text_segments: ::prost::alloc::vec::Vec<text_anchor::TextSegment>,
/// Contains the content of the text span so that users do
/// not have to look it up in the text_segments. It is always
/// populated for formFields.
#[prost(string, tag = "2")]
pub content: ::prost::alloc::string::String,
}
/// Nested message and enum types in `TextAnchor`.
pub mod text_anchor {
/// A text segment in the
/// [Document.text][google.cloud.documentai.v1.Document.text]. The indices
/// may be out of bounds which indicate that the text extends into another
/// document shard for large sharded documents. See
/// [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TextSegment {
/// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
/// start UTF-8 char index in the
/// [Document.text][google.cloud.documentai.v1.Document.text].
#[prost(int64, tag = "1")]
pub start_index: i64,
/// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
/// half open end UTF-8 char index in the
/// [Document.text][google.cloud.documentai.v1.Document.text].
#[prost(int64, tag = "2")]
pub end_index: i64,
}
}
/// Referencing the visual context of the entity in the
/// [Document.pages][google.cloud.documentai.v1.Document.pages]. Page anchors
/// can be cross-page, consist of multiple bounding polygons and optionally
/// reference specific layout element types.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PageAnchor {
/// One or more references to visual page elements
#[prost(message, repeated, tag = "1")]
pub page_refs: ::prost::alloc::vec::Vec<page_anchor::PageRef>,
}
/// Nested message and enum types in `PageAnchor`.
pub mod page_anchor {
/// Represents a weak reference to a page element within a document.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PageRef {
/// Required. Index into the
/// [Document.pages][google.cloud.documentai.v1.Document.pages] element,
/// for example using
/// `[Document.pages][page_refs.page]` to locate the related page element.
/// This field is skipped when its value is the default `0`. See
/// <https://developers.google.com/protocol-buffers/docs/proto3#json.>
#[prost(int64, tag = "1")]
pub page: i64,
/// Optional. The type of the layout element that is being referenced if
/// any.
#[prost(enumeration = "page_ref::LayoutType", tag = "2")]
pub layout_type: i32,
/// Optional. Deprecated. Use
/// [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]
/// instead.
#[deprecated]
#[prost(string, tag = "3")]
pub layout_id: ::prost::alloc::string::String,
/// Optional. Identifies the bounding polygon of a layout element on the
/// page. If `layout_type` is set, the bounding polygon must be exactly the
/// same to the layout element it's referring to.
#[prost(message, optional, tag = "4")]
pub bounding_poly: ::core::option::Option<super::super::BoundingPoly>,
/// Optional. Confidence of detected page element, if applicable. Range
/// `\[0, 1\]`.
#[prost(float, tag = "5")]
pub confidence: f32,
}
/// Nested message and enum types in `PageRef`.
pub mod page_ref {
/// The type of layout that is being referenced.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum LayoutType {
/// Layout Unspecified.
Unspecified = 0,
/// References a
/// [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks]
/// element.
Block = 1,
/// References a
/// [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs]
/// element.
Paragraph = 2,
/// References a
/// [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element.
Line = 3,
/// References a
/// [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens]
/// element.
Token = 4,
/// References a
/// [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements]
/// element.
VisualElement = 5,
/// Refrrences a
/// [Page.tables][google.cloud.documentai.v1.Document.Page.tables]
/// element.
Table = 6,
/// References a
/// [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields]
/// element.
FormField = 7,
}
impl LayoutType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
LayoutType::Unspecified => "LAYOUT_TYPE_UNSPECIFIED",
LayoutType::Block => "BLOCK",
LayoutType::Paragraph => "PARAGRAPH",
LayoutType::Line => "LINE",
LayoutType::Token => "TOKEN",
LayoutType::VisualElement => "VISUAL_ELEMENT",
LayoutType::Table => "TABLE",
LayoutType::FormField => "FORM_FIELD",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"LAYOUT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"BLOCK" => Some(Self::Block),
"PARAGRAPH" => Some(Self::Paragraph),
"LINE" => Some(Self::Line),
"TOKEN" => Some(Self::Token),
"VISUAL_ELEMENT" => Some(Self::VisualElement),
"TABLE" => Some(Self::Table),
"FORM_FIELD" => Some(Self::FormField),
_ => None,
}
}
}
}
}
/// Structure to identify provenance relationships between annotations in
/// different revisions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Provenance {
/// The index of the revision that produced this element.
#[deprecated]
#[prost(int32, tag = "1")]
pub revision: i32,
/// The Id of this operation. Needs to be unique within the scope of the
/// revision.
#[deprecated]
#[prost(int32, tag = "2")]
pub id: i32,
/// References to the original elements that are replaced.
#[prost(message, repeated, tag = "3")]
pub parents: ::prost::alloc::vec::Vec<provenance::Parent>,
/// The type of provenance operation.
#[prost(enumeration = "provenance::OperationType", tag = "4")]
pub r#type: i32,
}
/// Nested message and enum types in `Provenance`.
pub mod provenance {
/// The parent element the current element is based on. Used for
/// referencing/aligning, removal and replacement operations.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Parent {
/// The index of the index into current revision's parent_ids list.
#[prost(int32, tag = "1")]
pub revision: i32,
/// The index of the parent item in the corresponding item list (eg. list
/// of entities, properties within entities, etc.) in the parent revision.
#[prost(int32, tag = "3")]
pub index: i32,
/// The id of the parent provenance.
#[deprecated]
#[prost(int32, tag = "2")]
pub id: i32,
}
/// If a processor or agent does an explicit operation on existing elements.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum OperationType {
/// Operation type unspecified. If no operation is specified a provenance
/// entry is simply used to match against a `parent`.
Unspecified = 0,
/// Add an element.
Add = 1,
/// Remove an element identified by `parent`.
Remove = 2,
/// Updates any fields within the given provenance scope of the message. It
/// overwrites the fields rather than replacing them. Use this when you
/// want to update a field value of an entity without also updating all the
/// child properties.
Update = 7,
/// Currently unused. Replace an element identified by `parent`.
Replace = 3,
/// Deprecated. Request human review for the element identified by
/// `parent`.
EvalRequested = 4,
/// Deprecated. Element is reviewed and approved at human review,
/// confidence will be set to 1.0.
EvalApproved = 5,
/// Deprecated. Element is skipped in the validation process.
EvalSkipped = 6,
}
impl OperationType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
OperationType::Unspecified => "OPERATION_TYPE_UNSPECIFIED",
OperationType::Add => "ADD",
OperationType::Remove => "REMOVE",
OperationType::Update => "UPDATE",
OperationType::Replace => "REPLACE",
OperationType::EvalRequested => "EVAL_REQUESTED",
OperationType::EvalApproved => "EVAL_APPROVED",
OperationType::EvalSkipped => "EVAL_SKIPPED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"OPERATION_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"ADD" => Some(Self::Add),
"REMOVE" => Some(Self::Remove),
"UPDATE" => Some(Self::Update),
"REPLACE" => Some(Self::Replace),
"EVAL_REQUESTED" => Some(Self::EvalRequested),
"EVAL_APPROVED" => Some(Self::EvalApproved),
"EVAL_SKIPPED" => Some(Self::EvalSkipped),
_ => None,
}
}
}
}
/// Contains past or forward revisions of this document.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Revision {
/// Id of the revision, internally generated by doc proto storage.
/// Unique within the context of the document.
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
/// The revisions that this revision is based on. This can include one or
/// more parent (when documents are merged.) This field represents the
/// index into the `revisions` field.
#[deprecated]
#[prost(int32, repeated, packed = "false", tag = "2")]
pub parent: ::prost::alloc::vec::Vec<i32>,
/// The revisions that this revision is based on. Must include all the ids
/// that have anything to do with this revision - eg. there are
/// `provenance.parent.revision` fields that index into this field.
#[prost(string, repeated, tag = "7")]
pub parent_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// The time that the revision was created, internally generated by
/// doc proto storage at the time of create.
#[prost(message, optional, tag = "3")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// Human Review information of this revision.
#[prost(message, optional, tag = "6")]
pub human_review: ::core::option::Option<revision::HumanReview>,
/// Who/what made the change
#[prost(oneof = "revision::Source", tags = "4, 5")]
pub source: ::core::option::Option<revision::Source>,
}
/// Nested message and enum types in `Revision`.
pub mod revision {
/// Human Review information of the document.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HumanReview {
/// Human review state. e.g. `requested`, `succeeded`, `rejected`.
#[prost(string, tag = "1")]
pub state: ::prost::alloc::string::String,
/// A message providing more details about the current state of processing.
/// For example, the rejection reason when the state is `rejected`.
#[prost(string, tag = "2")]
pub state_message: ::prost::alloc::string::String,
}
/// Who/what made the change
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Source {
/// If the change was made by a person specify the name or id of that
/// person.
#[prost(string, tag = "4")]
Agent(::prost::alloc::string::String),
/// If the annotation was made by processor identify the processor by its
/// resource name.
#[prost(string, tag = "5")]
Processor(::prost::alloc::string::String),
}
}
/// This message is used for text changes aka. OCR corrections.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextChange {
/// Provenance of the correction.
/// Text anchor indexing into the
/// [Document.text][google.cloud.documentai.v1.Document.text]. There can
/// only be a single `TextAnchor.text_segments` element. If the start and
/// end index of the text segment are the same, the text change is inserted
/// before that index.
#[prost(message, optional, tag = "1")]
pub text_anchor: ::core::option::Option<TextAnchor>,
/// The text that replaces the text identified in the `text_anchor`.
#[prost(string, tag = "2")]
pub changed_text: ::prost::alloc::string::String,
/// The history of this annotation.
#[deprecated]
#[prost(message, repeated, tag = "3")]
pub provenance: ::prost::alloc::vec::Vec<Provenance>,
}
/// Represents the parsed layout of a document as a collection of blocks that
/// the document is divided into.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DocumentLayout {
/// List of blocks in the document.
#[prost(message, repeated, tag = "1")]
pub blocks: ::prost::alloc::vec::Vec<document_layout::DocumentLayoutBlock>,
}
/// Nested message and enum types in `DocumentLayout`.
pub mod document_layout {
/// Represents a block. A block could be one of the various types (text,
/// table, list) supported.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DocumentLayoutBlock {
/// ID of the block.
#[prost(string, tag = "1")]
pub block_id: ::prost::alloc::string::String,
/// Page span of the block.
#[prost(message, optional, tag = "5")]
pub page_span: ::core::option::Option<document_layout_block::LayoutPageSpan>,
#[prost(oneof = "document_layout_block::Block", tags = "2, 3, 4")]
pub block: ::core::option::Option<document_layout_block::Block>,
}
/// Nested message and enum types in `DocumentLayoutBlock`.
pub mod document_layout_block {
/// Represents where the block starts and ends in the document.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LayoutPageSpan {
/// Page where block starts in the document.
#[prost(int32, tag = "1")]
pub page_start: i32,
/// Page where block ends in the document.
#[prost(int32, tag = "2")]
pub page_end: i32,
}
/// Represents a text type block.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LayoutTextBlock {
/// Text content stored in the block.
#[prost(string, tag = "1")]
pub text: ::prost::alloc::string::String,
/// Type of the text in the block. Available options are: `paragraph`,
/// `subtitle`, `heading-1`, `heading-2`, `heading-3`, `heading-4`,
/// `heading-5`, `header`, `footer`.
#[prost(string, tag = "2")]
pub r#type: ::prost::alloc::string::String,
/// A text block could further have child blocks.
/// Repeated blocks support further hierarchies and nested blocks.
#[prost(message, repeated, tag = "3")]
pub blocks: ::prost::alloc::vec::Vec<super::DocumentLayoutBlock>,
}
/// Represents a table type block.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LayoutTableBlock {
/// Header rows at the top of the table.
#[prost(message, repeated, tag = "1")]
pub header_rows: ::prost::alloc::vec::Vec<LayoutTableRow>,
/// Body rows containing main table content.
#[prost(message, repeated, tag = "2")]
pub body_rows: ::prost::alloc::vec::Vec<LayoutTableRow>,
/// Table caption/title.
#[prost(string, tag = "3")]
pub caption: ::prost::alloc::string::String,
}
/// Represents a row in a table.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LayoutTableRow {
/// A table row is a list of table cells.
#[prost(message, repeated, tag = "1")]
pub cells: ::prost::alloc::vec::Vec<LayoutTableCell>,
}
/// Represents a cell in a table row.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LayoutTableCell {
/// A table cell is a list of blocks.
/// Repeated blocks support further hierarchies and nested blocks.
#[prost(message, repeated, tag = "1")]
pub blocks: ::prost::alloc::vec::Vec<super::DocumentLayoutBlock>,
/// How many rows this cell spans.
#[prost(int32, tag = "2")]
pub row_span: i32,
/// How many columns this cell spans.
#[prost(int32, tag = "3")]
pub col_span: i32,
}
/// Represents a list type block.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LayoutListBlock {
/// List entries that constitute a list block.
#[prost(message, repeated, tag = "1")]
pub list_entries: ::prost::alloc::vec::Vec<LayoutListEntry>,
/// Type of the list_entries (if exist). Available options are `ordered`
/// and `unordered`.
#[prost(string, tag = "2")]
pub r#type: ::prost::alloc::string::String,
}
/// Represents an entry in the list.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LayoutListEntry {
/// A list entry is a list of blocks.
/// Repeated blocks support further hierarchies and nested blocks.
#[prost(message, repeated, tag = "1")]
pub blocks: ::prost::alloc::vec::Vec<super::DocumentLayoutBlock>,
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Block {
/// Block consisting of text content.
#[prost(message, tag = "2")]
TextBlock(LayoutTextBlock),
/// Block consisting of table content/structure.
#[prost(message, tag = "3")]
TableBlock(LayoutTableBlock),
/// Block consisting of list content/structure.
#[prost(message, tag = "4")]
ListBlock(LayoutListBlock),
}
}
}
/// Represents the chunks that the document is divided into.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChunkedDocument {
/// List of chunks.
#[prost(message, repeated, tag = "1")]
pub chunks: ::prost::alloc::vec::Vec<chunked_document::Chunk>,
}
/// Nested message and enum types in `ChunkedDocument`.
pub mod chunked_document {
/// Represents a chunk.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Chunk {
/// ID of the chunk.
#[prost(string, tag = "1")]
pub chunk_id: ::prost::alloc::string::String,
/// Unused.
#[prost(string, repeated, tag = "2")]
pub source_block_ids: ::prost::alloc::vec::Vec<
::prost::alloc::string::String,
>,
/// Text content of the chunk.
#[prost(string, tag = "3")]
pub content: ::prost::alloc::string::String,
/// Page span of the chunk.
#[prost(message, optional, tag = "4")]
pub page_span: ::core::option::Option<chunk::ChunkPageSpan>,
/// Page headers associated with the chunk.
#[prost(message, repeated, tag = "5")]
pub page_headers: ::prost::alloc::vec::Vec<chunk::ChunkPageHeader>,
/// Page footers associated with the chunk.
#[prost(message, repeated, tag = "6")]
pub page_footers: ::prost::alloc::vec::Vec<chunk::ChunkPageFooter>,
}
/// Nested message and enum types in `Chunk`.
pub mod chunk {
/// Represents where the chunk starts and ends in the document.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ChunkPageSpan {
/// Page where chunk starts in the document.
#[prost(int32, tag = "1")]
pub page_start: i32,
/// Page where chunk ends in the document.
#[prost(int32, tag = "2")]
pub page_end: i32,
}
/// Represents the page header associated with the chunk.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChunkPageHeader {
/// Header in text format.
#[prost(string, tag = "1")]
pub text: ::prost::alloc::string::String,
/// Page span of the header.
#[prost(message, optional, tag = "2")]
pub page_span: ::core::option::Option<ChunkPageSpan>,
}
/// Represents the page footer associated with the chunk.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChunkPageFooter {
/// Footer in text format.
#[prost(string, tag = "1")]
pub text: ::prost::alloc::string::String,
/// Page span of the footer.
#[prost(message, optional, tag = "2")]
pub page_span: ::core::option::Option<ChunkPageSpan>,
}
}
}
/// Original source document from the user.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Source {
/// Optional. Currently supports Google Cloud Storage URI of the form
/// `gs://bucket_name/object_name`. Object versioning is not supported.
/// For more information, refer to [Google Cloud Storage Request
/// URIs](<https://cloud.google.com/storage/docs/reference-uris>).
#[prost(string, tag = "1")]
Uri(::prost::alloc::string::String),
/// Optional. Inline document content, represented as a stream of bytes.
/// Note: As with all `bytes` fields, protobuffers use a pure binary
/// representation, whereas JSON representations use base64.
#[prost(bytes, tag = "2")]
Content(::prost::bytes::Bytes),
}
}
/// A processor type is responsible for performing a certain document
/// understanding task on a certain type of document.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProcessorType {
/// The resource name of the processor type.
/// Format: `projects/{project}/processorTypes/{processor_type}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
#[prost(string, tag = "2")]
pub r#type: ::prost::alloc::string::String,
/// The processor category, used by UI to group processor types.
#[prost(string, tag = "3")]
pub category: ::prost::alloc::string::String,
/// The locations in which this processor is available.
#[prost(message, repeated, tag = "4")]
pub available_locations: ::prost::alloc::vec::Vec<processor_type::LocationInfo>,
/// Whether the processor type allows creation. If true, users can create a
/// processor of this processor type. Otherwise, users need to request access.
#[prost(bool, tag = "6")]
pub allow_creation: bool,
/// Launch stage of the processor type
#[prost(enumeration = "super::super::super::api::LaunchStage", tag = "8")]
pub launch_stage: i32,
/// A set of Cloud Storage URIs of sample documents for this processor.
#[prost(string, repeated, tag = "9")]
pub sample_document_uris: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Nested message and enum types in `ProcessorType`.
pub mod processor_type {
/// The location information about where the processor is available.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LocationInfo {
/// The location ID. For supported locations, refer to [regional and
/// multi-regional support](/document-ai/docs/regions).
#[prost(string, tag = "1")]
pub location_id: ::prost::alloc::string::String,
}
}
/// Payload message of raw document content (bytes).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawDocument {
/// Inline document content.
#[prost(bytes = "bytes", tag = "1")]
pub content: ::prost::bytes::Bytes,
/// An IANA MIME type (RFC6838) indicating the nature and format of the
/// [content][google.cloud.documentai.v1.RawDocument.content].
#[prost(string, tag = "2")]
pub mime_type: ::prost::alloc::string::String,
/// The display name of the document, it supports all Unicode characters except
/// the following:
/// `*`, `?`, `\[`, `\]`, `%`, `{`, `}`,`'`, `\"`, `,`
/// `~`, `=` and `:` are reserved.
/// If not specified, a default ID is generated.
#[prost(string, tag = "3")]
pub display_name: ::prost::alloc::string::String,
}
/// Specifies a document stored on Cloud Storage.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GcsDocument {
/// The Cloud Storage object uri.
#[prost(string, tag = "1")]
pub gcs_uri: ::prost::alloc::string::String,
/// An IANA MIME type (RFC6838) of the content.
#[prost(string, tag = "2")]
pub mime_type: ::prost::alloc::string::String,
}
/// Specifies a set of documents on Cloud Storage.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GcsDocuments {
/// The list of documents.
#[prost(message, repeated, tag = "1")]
pub documents: ::prost::alloc::vec::Vec<GcsDocument>,
}
/// Specifies all documents on Cloud Storage with a common prefix.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GcsPrefix {
/// The URI prefix.
#[prost(string, tag = "1")]
pub gcs_uri_prefix: ::prost::alloc::string::String,
}
/// The common config to specify a set of documents used as input.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchDocumentsInputConfig {
/// The source.
#[prost(oneof = "batch_documents_input_config::Source", tags = "1, 2")]
pub source: ::core::option::Option<batch_documents_input_config::Source>,
}
/// Nested message and enum types in `BatchDocumentsInputConfig`.
pub mod batch_documents_input_config {
/// The source.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Source {
/// The set of documents that match the specified Cloud Storage `gcs_prefix`.
#[prost(message, tag = "1")]
GcsPrefix(super::GcsPrefix),
/// The set of documents individually specified on Cloud Storage.
#[prost(message, tag = "2")]
GcsDocuments(super::GcsDocuments),
}
}
/// Config that controls the output of documents. All documents will be written
/// as a JSON file.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DocumentOutputConfig {
/// The destination of the results.
#[prost(oneof = "document_output_config::Destination", tags = "1")]
pub destination: ::core::option::Option<document_output_config::Destination>,
}
/// Nested message and enum types in `DocumentOutputConfig`.
pub mod document_output_config {
/// The configuration used when outputting documents.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GcsOutputConfig {
/// The Cloud Storage uri (a directory) of the output.
#[prost(string, tag = "1")]
pub gcs_uri: ::prost::alloc::string::String,
/// Specifies which fields to include in the output documents.
/// Only supports top level document and pages field so it must be in the
/// form of `{document_field_name}` or `pages.{page_field_name}`.
#[prost(message, optional, tag = "2")]
pub field_mask: ::core::option::Option<::prost_types::FieldMask>,
/// Specifies the sharding config for the output document.
#[prost(message, optional, tag = "3")]
pub sharding_config: ::core::option::Option<gcs_output_config::ShardingConfig>,
}
/// Nested message and enum types in `GcsOutputConfig`.
pub mod gcs_output_config {
/// The sharding config for the output document.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ShardingConfig {
/// The number of pages per shard.
#[prost(int32, tag = "1")]
pub pages_per_shard: i32,
/// The number of overlapping pages between consecutive shards.
#[prost(int32, tag = "2")]
pub pages_overlap: i32,
}
}
/// The destination of the results.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Destination {
/// Output config to write the results to Cloud Storage.
#[prost(message, tag = "1")]
GcsOutputConfig(GcsOutputConfig),
}
}
/// Config for Document OCR.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OcrConfig {
/// Hints for the OCR model.
#[prost(message, optional, tag = "2")]
pub hints: ::core::option::Option<ocr_config::Hints>,
/// Enables special handling for PDFs with existing text information. Results
/// in better text extraction quality in such PDF inputs.
#[prost(bool, tag = "3")]
pub enable_native_pdf_parsing: bool,
/// Enables intelligent document quality scores after OCR. Can help with
/// diagnosing why OCR responses are of poor quality for a given input.
/// Adds additional latency comparable to regular OCR to the process call.
#[prost(bool, tag = "4")]
pub enable_image_quality_scores: bool,
/// A list of advanced OCR options to further fine-tune OCR behavior. Current
/// valid values are:
///
/// - `legacy_layout`: a heuristics layout detection algorithm, which serves as
/// an alternative to the current ML-based layout detection algorithm.
/// Customers can choose the best suitable layout algorithm based on their
/// situation.
#[prost(string, repeated, tag = "5")]
pub advanced_ocr_options: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Includes symbol level OCR information if set to true.
#[prost(bool, tag = "6")]
pub enable_symbol: bool,
/// Turn on font identification model and return font style information.
/// Deprecated, use
/// [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]
/// instead.
#[deprecated]
#[prost(bool, tag = "8")]
pub compute_style_info: bool,
/// Turn off character box detector in OCR engine. Character box detection is
/// enabled by default in OCR 2.0 (and later) processors.
#[prost(bool, tag = "10")]
pub disable_character_boxes_detection: bool,
/// Configurations for premium OCR features.
#[prost(message, optional, tag = "11")]
pub premium_features: ::core::option::Option<ocr_config::PremiumFeatures>,
}
/// Nested message and enum types in `OcrConfig`.
pub mod ocr_config {
/// Hints for OCR Engine
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Hints {
/// List of BCP-47 language codes to use for OCR. In most cases, not
/// specifying it yields the best results since it enables automatic language
/// detection. For languages based on the Latin alphabet, setting hints is
/// not needed. In rare cases, when the language of the text in the
/// image is known, setting a hint will help get better results (although it
/// will be a significant hindrance if the hint is wrong).
#[prost(string, repeated, tag = "1")]
pub language_hints: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Configurations for premium OCR features.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PremiumFeatures {
/// Turn on selection mark detector in OCR engine. Only available in OCR 2.0
/// (and later) processors.
#[prost(bool, tag = "3")]
pub enable_selection_mark_detection: bool,
/// Turn on font identification model and return font style information.
#[prost(bool, tag = "4")]
pub compute_style_info: bool,
/// Turn on the model that can extract LaTeX math formulas.
#[prost(bool, tag = "5")]
pub enable_math_ocr: bool,
}
}
/// The schema defines the output of the processed document by a processor.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DocumentSchema {
/// Display name to show to users.
#[prost(string, tag = "1")]
pub display_name: ::prost::alloc::string::String,
/// Description of the schema.
#[prost(string, tag = "2")]
pub description: ::prost::alloc::string::String,
/// Entity types of the schema.
#[prost(message, repeated, tag = "3")]
pub entity_types: ::prost::alloc::vec::Vec<document_schema::EntityType>,
/// Metadata of the schema.
#[prost(message, optional, tag = "4")]
pub metadata: ::core::option::Option<document_schema::Metadata>,
}
/// Nested message and enum types in `DocumentSchema`.
pub mod document_schema {
/// EntityType is the wrapper of a label of the corresponding model with
/// detailed attributes and limitations for entity-based processors. Multiple
/// types can also compose a dependency tree to represent nested types.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EntityType {
/// User defined name for the type.
#[prost(string, tag = "13")]
pub display_name: ::prost::alloc::string::String,
/// Name of the type. It must be unique within the schema file and
/// cannot be a "Common Type". The following naming conventions are used:
///
/// - Use `snake_casing`.
/// - Name matching is case-sensitive.
/// - Maximum 64 characters.
/// - Must start with a letter.
/// - Allowed characters: ASCII letters `\[a-z0-9_-\]`. (For backward
/// compatibility internal infrastructure and tooling can handle any ascii
/// character.)
/// - The `/` is sometimes used to denote a property of a type. For example
/// `line_item/amount`. This convention is deprecated, but will still be
/// honored for backward compatibility.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The entity type that this type is derived from. For now, one and only
/// one should be set.
#[prost(string, repeated, tag = "2")]
pub base_types: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Description the nested structure, or composition of an entity.
#[prost(message, repeated, tag = "6")]
pub properties: ::prost::alloc::vec::Vec<entity_type::Property>,
#[prost(oneof = "entity_type::ValueSource", tags = "14")]
pub value_source: ::core::option::Option<entity_type::ValueSource>,
}
/// Nested message and enum types in `EntityType`.
pub mod entity_type {
/// Defines the a list of enum values.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EnumValues {
/// The individual values that this enum values type can include.
#[prost(string, repeated, tag = "1")]
pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Defines properties that can be part of the entity type.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Property {
/// The name of the property. Follows the same guidelines as the
/// EntityType name.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// User defined name for the property.
#[prost(string, tag = "6")]
pub display_name: ::prost::alloc::string::String,
/// A reference to the value type of the property. This type is subject
/// to the same conventions as the `Entity.base_types` field.
#[prost(string, tag = "2")]
pub value_type: ::prost::alloc::string::String,
/// Occurrence type limits the number of instances an entity type appears
/// in the document.
#[prost(enumeration = "property::OccurrenceType", tag = "3")]
pub occurrence_type: i32,
}
/// Nested message and enum types in `Property`.
pub mod property {
/// Types of occurrences of the entity type in the document. This
/// represents the number of instances, not mentions, of an entity.
/// For example, a bank statement might only have one
/// `account_number`, but this account number can be mentioned in several
/// places on the document. In this case, the `account_number` is
/// considered a `REQUIRED_ONCE` entity type. If, on the other hand, we
/// expect a bank statement to contain the status of multiple different
/// accounts for the customers, the occurrence type is set to
/// `REQUIRED_MULTIPLE`.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum OccurrenceType {
/// Unspecified occurrence type.
Unspecified = 0,
/// There will be zero or one instance of this entity type. The same
/// entity instance may be mentioned multiple times.
OptionalOnce = 1,
/// The entity type will appear zero or multiple times.
OptionalMultiple = 2,
/// The entity type will only appear exactly once. The same
/// entity instance may be mentioned multiple times.
RequiredOnce = 3,
/// The entity type will appear once or more times.
RequiredMultiple = 4,
}
impl OccurrenceType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
OccurrenceType::Unspecified => "OCCURRENCE_TYPE_UNSPECIFIED",
OccurrenceType::OptionalOnce => "OPTIONAL_ONCE",
OccurrenceType::OptionalMultiple => "OPTIONAL_MULTIPLE",
OccurrenceType::RequiredOnce => "REQUIRED_ONCE",
OccurrenceType::RequiredMultiple => "REQUIRED_MULTIPLE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"OCCURRENCE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"OPTIONAL_ONCE" => Some(Self::OptionalOnce),
"OPTIONAL_MULTIPLE" => Some(Self::OptionalMultiple),
"REQUIRED_ONCE" => Some(Self::RequiredOnce),
"REQUIRED_MULTIPLE" => Some(Self::RequiredMultiple),
_ => None,
}
}
}
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ValueSource {
/// If specified, lists all the possible values for this entity. This
/// should not be more than a handful of values. If the number of values
/// is >10 or could change frequently use the `EntityType.value_ontology`
/// field and specify a list of all possible values in a value ontology
/// file.
#[prost(message, tag = "14")]
EnumValues(EnumValues),
}
}
/// Metadata for global schema behavior.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Metadata {
/// If true, a `document` entity type can be applied to subdocument
/// (splitting). Otherwise, it can only be applied to the entire document
/// (classification).
#[prost(bool, tag = "1")]
pub document_splitter: bool,
/// If true, on a given page, there can be multiple `document` annotations
/// covering it.
#[prost(bool, tag = "2")]
pub document_allow_multiple_labels: bool,
/// If set, all the nested entities must be prefixed with the parents.
#[prost(bool, tag = "6")]
pub prefixed_naming_on_properties: bool,
/// If set, we will skip the naming format validation in the schema. So the
/// string values in `DocumentSchema.EntityType.name` and
/// `DocumentSchema.EntityType.Property.name` will not be checked.
#[prost(bool, tag = "7")]
pub skip_naming_validation: bool,
}
}
/// Gives a short summary of an evaluation, and links to the evaluation itself.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EvaluationReference {
/// The resource name of the Long Running Operation for the evaluation.
#[prost(string, tag = "1")]
pub operation: ::prost::alloc::string::String,
/// The resource name of the evaluation.
#[prost(string, tag = "2")]
pub evaluation: ::prost::alloc::string::String,
/// An aggregate of the statistics for the evaluation with fuzzy matching on.
#[prost(message, optional, tag = "4")]
pub aggregate_metrics: ::core::option::Option<evaluation::Metrics>,
/// An aggregate of the statistics for the evaluation with fuzzy matching off.
#[prost(message, optional, tag = "5")]
pub aggregate_metrics_exact: ::core::option::Option<evaluation::Metrics>,
}
/// An evaluation of a ProcessorVersion's performance.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Evaluation {
/// The resource name of the evaluation.
/// Format:
/// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The time that the evaluation was created.
#[prost(message, optional, tag = "2")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// Counters for the documents used in the evaluation.
#[prost(message, optional, tag = "5")]
pub document_counters: ::core::option::Option<evaluation::Counters>,
/// Metrics for all the entities in aggregate.
#[prost(message, optional, tag = "3")]
pub all_entities_metrics: ::core::option::Option<evaluation::MultiConfidenceMetrics>,
/// Metrics across confidence levels, for different entities.
#[prost(btree_map = "string, message", tag = "4")]
pub entity_metrics: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
evaluation::MultiConfidenceMetrics,
>,
/// The KMS key name used for encryption.
#[prost(string, tag = "6")]
pub kms_key_name: ::prost::alloc::string::String,
/// The KMS key version with which data is encrypted.
#[prost(string, tag = "7")]
pub kms_key_version_name: ::prost::alloc::string::String,
}
/// Nested message and enum types in `Evaluation`.
pub mod evaluation {
/// Evaluation counters for the documents that were used.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Counters {
/// How many documents were sent for evaluation.
#[prost(int32, tag = "1")]
pub input_documents_count: i32,
/// How many documents were not included in the evaluation as they didn't
/// pass validation.
#[prost(int32, tag = "2")]
pub invalid_documents_count: i32,
/// How many documents were not included in the evaluation as Document AI
/// failed to process them.
#[prost(int32, tag = "3")]
pub failed_documents_count: i32,
/// How many documents were used in the evaluation.
#[prost(int32, tag = "4")]
pub evaluated_documents_count: i32,
}
/// Evaluation metrics, either in aggregate or about a specific entity.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Metrics {
/// The calculated precision.
#[prost(float, tag = "1")]
pub precision: f32,
/// The calculated recall.
#[prost(float, tag = "2")]
pub recall: f32,
/// The calculated f1 score.
#[prost(float, tag = "3")]
pub f1_score: f32,
/// The amount of occurrences in predicted documents.
#[prost(int32, tag = "4")]
pub predicted_occurrences_count: i32,
/// The amount of occurrences in ground truth documents.
#[prost(int32, tag = "5")]
pub ground_truth_occurrences_count: i32,
/// The amount of documents with a predicted occurrence.
#[prost(int32, tag = "10")]
pub predicted_document_count: i32,
/// The amount of documents with a ground truth occurrence.
#[prost(int32, tag = "11")]
pub ground_truth_document_count: i32,
/// The amount of true positives.
#[prost(int32, tag = "6")]
pub true_positives_count: i32,
/// The amount of false positives.
#[prost(int32, tag = "7")]
pub false_positives_count: i32,
/// The amount of false negatives.
#[prost(int32, tag = "8")]
pub false_negatives_count: i32,
/// The amount of documents that had an occurrence of this label.
#[prost(int32, tag = "9")]
pub total_documents_count: i32,
}
/// Evaluations metrics, at a specific confidence level.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ConfidenceLevelMetrics {
/// The confidence level.
#[prost(float, tag = "1")]
pub confidence_level: f32,
/// The metrics at the specific confidence level.
#[prost(message, optional, tag = "2")]
pub metrics: ::core::option::Option<Metrics>,
}
/// Metrics across multiple confidence levels.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MultiConfidenceMetrics {
/// Metrics across confidence levels with fuzzy matching enabled.
#[prost(message, repeated, tag = "1")]
pub confidence_level_metrics: ::prost::alloc::vec::Vec<ConfidenceLevelMetrics>,
/// Metrics across confidence levels with only exact matching.
#[prost(message, repeated, tag = "4")]
pub confidence_level_metrics_exact: ::prost::alloc::vec::Vec<
ConfidenceLevelMetrics,
>,
/// The calculated area under the precision recall curve (AUPRC), computed by
/// integrating over all confidence thresholds.
#[prost(float, tag = "2")]
pub auprc: f32,
/// The Estimated Calibration Error (ECE) of the confidence of the predicted
/// entities.
#[prost(float, tag = "3")]
pub estimated_calibration_error: f32,
/// The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching
/// only.
#[prost(float, tag = "5")]
pub auprc_exact: f32,
/// The ECE for the predicted entities with fuzzy matching disabled, i.e.,
/// exact matching only.
#[prost(float, tag = "6")]
pub estimated_calibration_error_exact: f32,
/// The metrics type for the label.
#[prost(enumeration = "multi_confidence_metrics::MetricsType", tag = "7")]
pub metrics_type: i32,
}
/// Nested message and enum types in `MultiConfidenceMetrics`.
pub mod multi_confidence_metrics {
/// A type that determines how metrics should be interpreted.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum MetricsType {
/// The metrics type is unspecified. By default, metrics without a
/// particular specification are for leaf entity types (i.e., top-level
/// entity types without child types, or child types which are not
/// parent types themselves).
Unspecified = 0,
/// Indicates whether metrics for this particular label type represent an
/// aggregate of metrics for other types instead of being based on actual
/// TP/FP/FN values for the label type. Metrics for parent (i.e., non-leaf)
/// entity types are an aggregate of metrics for their children.
Aggregate = 1,
}
impl MetricsType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
MetricsType::Unspecified => "METRICS_TYPE_UNSPECIFIED",
MetricsType::Aggregate => "AGGREGATE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"METRICS_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"AGGREGATE" => Some(Self::Aggregate),
_ => None,
}
}
}
}
}
/// A processor version is an implementation of a processor. Each processor
/// can have multiple versions, pretrained by Google internally or uptrained
/// by the customer. A processor can only have one default version at a time.
/// Its document-processing behavior is defined by that version.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProcessorVersion {
/// Identifier. The resource name of the processor version.
/// Format:
/// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The display name of the processor version.
#[prost(string, tag = "2")]
pub display_name: ::prost::alloc::string::String,
/// The schema of the processor version. Describes the output.
#[prost(message, optional, tag = "12")]
pub document_schema: ::core::option::Option<DocumentSchema>,
/// Output only. The state of the processor version.
#[prost(enumeration = "processor_version::State", tag = "6")]
pub state: i32,
/// The time the processor version was created.
#[prost(message, optional, tag = "7")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// The most recently invoked evaluation for the processor version.
#[prost(message, optional, tag = "8")]
pub latest_evaluation: ::core::option::Option<EvaluationReference>,
/// The KMS key name used for encryption.
#[prost(string, tag = "9")]
pub kms_key_name: ::prost::alloc::string::String,
/// The KMS key version with which data is encrypted.
#[prost(string, tag = "10")]
pub kms_key_version_name: ::prost::alloc::string::String,
/// Output only. Denotes that this `ProcessorVersion` is managed by Google.
#[prost(bool, tag = "11")]
pub google_managed: bool,
/// If set, information about the eventual deprecation of this version.
#[prost(message, optional, tag = "13")]
pub deprecation_info: ::core::option::Option<processor_version::DeprecationInfo>,
/// Output only. The model type of this processor version.
#[prost(enumeration = "processor_version::ModelType", tag = "15")]
pub model_type: i32,
/// Output only. Reserved for future use.
#[prost(bool, tag = "16")]
pub satisfies_pzs: bool,
/// Output only. Reserved for future use.
#[prost(bool, tag = "17")]
pub satisfies_pzi: bool,
/// Output only. Information about Generative AI model-based processor
/// versions.
#[prost(message, optional, tag = "18")]
pub gen_ai_model_info: ::core::option::Option<processor_version::GenAiModelInfo>,
}
/// Nested message and enum types in `ProcessorVersion`.
pub mod processor_version {
/// Information about the upcoming deprecation of this processor version.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeprecationInfo {
/// The time at which this processor version will be deprecated.
#[prost(message, optional, tag = "1")]
pub deprecation_time: ::core::option::Option<::prost_types::Timestamp>,
/// If set, the processor version that will be used as a replacement.
#[prost(string, tag = "2")]
pub replacement_processor_version: ::prost::alloc::string::String,
}
/// Information about Generative AI model-based processor versions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GenAiModelInfo {
/// The processor version is either a pretrained Google-managed foundation
/// model or a custom Generative AI model created by the user.
#[prost(oneof = "gen_ai_model_info::ModelInfo", tags = "1, 2")]
pub model_info: ::core::option::Option<gen_ai_model_info::ModelInfo>,
}
/// Nested message and enum types in `GenAiModelInfo`.
pub mod gen_ai_model_info {
/// Information for a pretrained Google-managed foundation model.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FoundationGenAiModelInfo {
/// Whether finetuning is allowed for this base processor version.
#[prost(bool, tag = "1")]
pub finetuning_allowed: bool,
/// The minimum number of labeled documents in the training dataset
/// required for finetuning.
#[prost(int32, tag = "2")]
pub min_train_labeled_documents: i32,
}
/// Information for a custom Generative AI model created by the user. These
/// are created with `Create New Version` in either the `Call foundation
/// model` or `Fine tuning` tabs.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CustomGenAiModelInfo {
/// The type of custom model created by the user.
#[prost(
enumeration = "custom_gen_ai_model_info::CustomModelType",
tag = "1"
)]
pub custom_model_type: i32,
/// The base processor version ID for the custom model.
#[prost(string, tag = "2")]
pub base_processor_version_id: ::prost::alloc::string::String,
}
/// Nested message and enum types in `CustomGenAiModelInfo`.
pub mod custom_gen_ai_model_info {
/// The type of custom model created by the user.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum CustomModelType {
/// The model type is unspecified.
Unspecified = 0,
/// The model is a versioned foundation model.
VersionedFoundation = 1,
/// The model is a finetuned foundation model.
FineTuned = 2,
}
impl CustomModelType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
CustomModelType::Unspecified => "CUSTOM_MODEL_TYPE_UNSPECIFIED",
CustomModelType::VersionedFoundation => "VERSIONED_FOUNDATION",
CustomModelType::FineTuned => "FINE_TUNED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CUSTOM_MODEL_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"VERSIONED_FOUNDATION" => Some(Self::VersionedFoundation),
"FINE_TUNED" => Some(Self::FineTuned),
_ => None,
}
}
}
}
/// The processor version is either a pretrained Google-managed foundation
/// model or a custom Generative AI model created by the user.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ModelInfo {
/// Information for a pretrained Google-managed foundation model.
#[prost(message, tag = "1")]
FoundationGenAiModelInfo(FoundationGenAiModelInfo),
/// Information for a custom Generative AI model created by the user.
#[prost(message, tag = "2")]
CustomGenAiModelInfo(CustomGenAiModelInfo),
}
}
/// The possible states of the processor version.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum State {
/// The processor version is in an unspecified state.
Unspecified = 0,
/// The processor version is deployed and can be used for processing.
Deployed = 1,
/// The processor version is being deployed.
Deploying = 2,
/// The processor version is not deployed and cannot be used for processing.
Undeployed = 3,
/// The processor version is being undeployed.
Undeploying = 4,
/// The processor version is being created.
Creating = 5,
/// The processor version is being deleted.
Deleting = 6,
/// The processor version failed and is in an indeterminate state.
Failed = 7,
/// The processor version is being imported.
Importing = 8,
}
impl State {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
State::Unspecified => "STATE_UNSPECIFIED",
State::Deployed => "DEPLOYED",
State::Deploying => "DEPLOYING",
State::Undeployed => "UNDEPLOYED",
State::Undeploying => "UNDEPLOYING",
State::Creating => "CREATING",
State::Deleting => "DELETING",
State::Failed => "FAILED",
State::Importing => "IMPORTING",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STATE_UNSPECIFIED" => Some(Self::Unspecified),
"DEPLOYED" => Some(Self::Deployed),
"DEPLOYING" => Some(Self::Deploying),
"UNDEPLOYED" => Some(Self::Undeployed),
"UNDEPLOYING" => Some(Self::Undeploying),
"CREATING" => Some(Self::Creating),
"DELETING" => Some(Self::Deleting),
"FAILED" => Some(Self::Failed),
"IMPORTING" => Some(Self::Importing),
_ => None,
}
}
}
/// The possible model types of the processor version.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ModelType {
/// The processor version has unspecified model type.
Unspecified = 0,
/// The processor version has generative model type.
Generative = 1,
/// The processor version has custom model type.
Custom = 2,
}
impl ModelType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
ModelType::Unspecified => "MODEL_TYPE_UNSPECIFIED",
ModelType::Generative => "MODEL_TYPE_GENERATIVE",
ModelType::Custom => "MODEL_TYPE_CUSTOM",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"MODEL_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"MODEL_TYPE_GENERATIVE" => Some(Self::Generative),
"MODEL_TYPE_CUSTOM" => Some(Self::Custom),
_ => None,
}
}
}
}
/// Contains the alias and the aliased resource name of processor version.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProcessorVersionAlias {
/// The alias in the form of `processor_version` resource name.
#[prost(string, tag = "1")]
pub alias: ::prost::alloc::string::String,
/// The resource name of aliased processor version.
#[prost(string, tag = "2")]
pub processor_version: ::prost::alloc::string::String,
}
/// The first-class citizen for Document AI. Each processor defines how to
/// extract structural information from a document.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Processor {
/// Output only. Immutable. The resource name of the processor.
/// Format: `projects/{project}/locations/{location}/processors/{processor}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
/// To get a list of processor types, see
/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes].
#[prost(string, tag = "2")]
pub r#type: ::prost::alloc::string::String,
/// The display name of the processor.
#[prost(string, tag = "3")]
pub display_name: ::prost::alloc::string::String,
/// Output only. The state of the processor.
#[prost(enumeration = "processor::State", tag = "4")]
pub state: i32,
/// The default processor version.
#[prost(string, tag = "9")]
pub default_processor_version: ::prost::alloc::string::String,
/// Output only. The processor version aliases.
#[prost(message, repeated, tag = "10")]
pub processor_version_aliases: ::prost::alloc::vec::Vec<ProcessorVersionAlias>,
/// Output only. Immutable. The http endpoint that can be called to invoke
/// processing.
#[prost(string, tag = "6")]
pub process_endpoint: ::prost::alloc::string::String,
/// The time the processor was created.
#[prost(message, optional, tag = "7")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// The [KMS key](<https://cloud.google.com/security-key-management>) used for
/// encryption and decryption in CMEK scenarios.
#[prost(string, tag = "8")]
pub kms_key_name: ::prost::alloc::string::String,
/// Output only. Reserved for future use.
#[prost(bool, tag = "12")]
pub satisfies_pzs: bool,
/// Output only. Reserved for future use.
#[prost(bool, tag = "13")]
pub satisfies_pzi: bool,
}
/// Nested message and enum types in `Processor`.
pub mod processor {
/// The possible states of the processor.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum State {
/// The processor is in an unspecified state.
Unspecified = 0,
/// The processor is enabled, i.e., has an enabled version which can
/// currently serve processing requests and all the feature dependencies have
/// been successfully initialized.
Enabled = 1,
/// The processor is disabled.
Disabled = 2,
/// The processor is being enabled, will become `ENABLED` if successful.
Enabling = 3,
/// The processor is being disabled, will become `DISABLED` if successful.
Disabling = 4,
/// The processor is being created, will become either `ENABLED` (for
/// successful creation) or `FAILED` (for failed ones).
/// Once a processor is in this state, it can then be used for document
/// processing, but the feature dependencies of the processor might not be
/// fully created yet.
Creating = 5,
/// The processor failed during creation or initialization of feature
/// dependencies. The user should delete the processor and recreate one as
/// all the functionalities of the processor are disabled.
Failed = 6,
/// The processor is being deleted, will be removed if successful.
Deleting = 7,
}
impl State {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
State::Unspecified => "STATE_UNSPECIFIED",
State::Enabled => "ENABLED",
State::Disabled => "DISABLED",
State::Enabling => "ENABLING",
State::Disabling => "DISABLING",
State::Creating => "CREATING",
State::Failed => "FAILED",
State::Deleting => "DELETING",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STATE_UNSPECIFIED" => Some(Self::Unspecified),
"ENABLED" => Some(Self::Enabled),
"DISABLED" => Some(Self::Disabled),
"ENABLING" => Some(Self::Enabling),
"DISABLING" => Some(Self::Disabling),
"CREATING" => Some(Self::Creating),
"FAILED" => Some(Self::Failed),
"DELETING" => Some(Self::Deleting),
_ => None,
}
}
}
}
/// The common metadata for long running operations.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommonOperationMetadata {
/// The state of the operation.
#[prost(enumeration = "common_operation_metadata::State", tag = "1")]
pub state: i32,
/// A message providing more details about the current state of processing.
#[prost(string, tag = "2")]
pub state_message: ::prost::alloc::string::String,
/// A related resource to this operation.
#[prost(string, tag = "5")]
pub resource: ::prost::alloc::string::String,
/// The creation time of the operation.
#[prost(message, optional, tag = "3")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// The last update time of the operation.
#[prost(message, optional, tag = "4")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// Nested message and enum types in `CommonOperationMetadata`.
pub mod common_operation_metadata {
/// State of the longrunning operation.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum State {
/// Unspecified state.
Unspecified = 0,
/// Operation is still running.
Running = 1,
/// Operation is being cancelled.
Cancelling = 2,
/// Operation succeeded.
Succeeded = 3,
/// Operation failed.
Failed = 4,
/// Operation is cancelled.
Cancelled = 5,
}
impl State {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
State::Unspecified => "STATE_UNSPECIFIED",
State::Running => "RUNNING",
State::Cancelling => "CANCELLING",
State::Succeeded => "SUCCEEDED",
State::Failed => "FAILED",
State::Cancelled => "CANCELLED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STATE_UNSPECIFIED" => Some(Self::Unspecified),
"RUNNING" => Some(Self::Running),
"CANCELLING" => Some(Self::Cancelling),
"SUCCEEDED" => Some(Self::Succeeded),
"FAILED" => Some(Self::Failed),
"CANCELLED" => Some(Self::Cancelled),
_ => None,
}
}
}
}
/// Options for Process API
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProcessOptions {
/// Only applicable to `OCR_PROCESSOR` and `FORM_PARSER_PROCESSOR`.
/// Returns error if set on other processor types.
#[prost(message, optional, tag = "1")]
pub ocr_config: ::core::option::Option<OcrConfig>,
/// Optional. Only applicable to `LAYOUT_PARSER_PROCESSOR`.
/// Returns error if set on other processor types.
#[prost(message, optional, tag = "9")]
pub layout_config: ::core::option::Option<process_options::LayoutConfig>,
/// Optional. Override the schema of the
/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. Will
/// return an Invalid Argument error if this field is set when the underlying
/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] doesn't
/// support schema override.
#[prost(message, optional, tag = "8")]
pub schema_override: ::core::option::Option<DocumentSchema>,
/// A subset of pages to process. If not specified, all pages are processed.
/// If a page range is set, only the given pages are extracted and processed
/// from the document. In the output document,
/// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
/// refers to the page number in the original document. This configuration
/// only applies to sync requests.
#[prost(oneof = "process_options::PageRange", tags = "5, 6, 7")]
pub page_range: ::core::option::Option<process_options::PageRange>,
}
/// Nested message and enum types in `ProcessOptions`.
pub mod process_options {
/// Serving config for layout parser processor.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LayoutConfig {
/// Optional. Config for chunking in layout parser processor.
#[prost(message, optional, tag = "1")]
pub chunking_config: ::core::option::Option<layout_config::ChunkingConfig>,
}
/// Nested message and enum types in `LayoutConfig`.
pub mod layout_config {
/// Serving config for chunking.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ChunkingConfig {
/// Optional. The chunk sizes to use when splitting documents, in order of
/// level.
#[prost(int32, tag = "1")]
pub chunk_size: i32,
/// Optional. Whether or not to include ancestor headings when splitting.
#[prost(bool, tag = "2")]
pub include_ancestor_headings: bool,
}
}
/// A list of individual page numbers.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IndividualPageSelector {
/// Optional. Indices of the pages (starting from 1).
#[prost(int32, repeated, packed = "false", tag = "1")]
pub pages: ::prost::alloc::vec::Vec<i32>,
}
/// A subset of pages to process. If not specified, all pages are processed.
/// If a page range is set, only the given pages are extracted and processed
/// from the document. In the output document,
/// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
/// refers to the page number in the original document. This configuration
/// only applies to sync requests.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum PageRange {
/// Which pages to process (1-indexed).
#[prost(message, tag = "5")]
IndividualPageSelector(IndividualPageSelector),
/// Only process certain pages from the start. Process all if the document
/// has fewer pages.
#[prost(int32, tag = "6")]
FromStart(i32),
/// Only process certain pages from the end, same as above.
#[prost(int32, tag = "7")]
FromEnd(i32),
}
}
/// Request message for the
/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProcessRequest {
/// Required. The resource name of the
/// [Processor][google.cloud.documentai.v1.Processor] or
/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]
/// to use for processing. If a
/// [Processor][google.cloud.documentai.v1.Processor] is specified, the server
/// will use its [default
/// version][google.cloud.documentai.v1.Processor.default_processor_version].
/// Format: `projects/{project}/locations/{location}/processors/{processor}`,
/// or
/// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Whether human review should be skipped for this request. Default to
/// `false`.
#[prost(bool, tag = "3")]
pub skip_human_review: bool,
/// Specifies which fields to include in the
/// [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document]
/// output. Only supports top-level document and pages field, so it must be in
/// the form of `{document_field_name}` or `pages.{page_field_name}`.
#[prost(message, optional, tag = "6")]
pub field_mask: ::core::option::Option<::prost_types::FieldMask>,
/// Inference-time options for the process API
#[prost(message, optional, tag = "7")]
pub process_options: ::core::option::Option<ProcessOptions>,
/// Optional. The labels with user-defined metadata for the request.
///
/// Label keys and values can be no longer than 63 characters
/// (Unicode codepoints) and can only contain lowercase letters, numeric
/// characters, underscores, and dashes. International characters are allowed.
/// Label values are optional. Label keys must start with a letter.
#[prost(btree_map = "string, string", tag = "10")]
pub labels: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
/// Optional. Option to remove images from the document.
#[prost(bool, tag = "11")]
pub imageless_mode: bool,
/// The document payload.
#[prost(oneof = "process_request::Source", tags = "4, 5, 8")]
pub source: ::core::option::Option<process_request::Source>,
}
/// Nested message and enum types in `ProcessRequest`.
pub mod process_request {
/// The document payload.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Source {
/// An inline document proto.
#[prost(message, tag = "4")]
InlineDocument(super::Document),
/// A raw document content (bytes).
#[prost(message, tag = "5")]
RawDocument(super::RawDocument),
/// A raw document on Google Cloud Storage.
#[prost(message, tag = "8")]
GcsDocument(super::GcsDocument),
}
}
/// The status of human review on a processed document.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HumanReviewStatus {
/// The state of human review on the processing request.
#[prost(enumeration = "human_review_status::State", tag = "1")]
pub state: i32,
/// A message providing more details about the human review state.
#[prost(string, tag = "2")]
pub state_message: ::prost::alloc::string::String,
/// The name of the operation triggered by the processed document. This field
/// is populated only when the
/// [state][google.cloud.documentai.v1.HumanReviewStatus.state] is
/// `HUMAN_REVIEW_IN_PROGRESS`. It has the same response type and metadata as
/// the long-running operation returned by
/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument].
#[prost(string, tag = "3")]
pub human_review_operation: ::prost::alloc::string::String,
}
/// Nested message and enum types in `HumanReviewStatus`.
pub mod human_review_status {
/// The final state of human review on a processed document.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum State {
/// Human review state is unspecified. Most likely due to an internal error.
Unspecified = 0,
/// Human review is skipped for the document. This can happen because human
/// review isn't enabled on the processor or the processing request has
/// been set to skip this document.
Skipped = 1,
/// Human review validation is triggered and passed, so no review is needed.
ValidationPassed = 2,
/// Human review validation is triggered and the document is under review.
InProgress = 3,
/// Some error happened during triggering human review, see the
/// [state_message][google.cloud.documentai.v1.HumanReviewStatus.state_message]
/// for details.
Error = 4,
}
impl State {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
State::Unspecified => "STATE_UNSPECIFIED",
State::Skipped => "SKIPPED",
State::ValidationPassed => "VALIDATION_PASSED",
State::InProgress => "IN_PROGRESS",
State::Error => "ERROR",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STATE_UNSPECIFIED" => Some(Self::Unspecified),
"SKIPPED" => Some(Self::Skipped),
"VALIDATION_PASSED" => Some(Self::ValidationPassed),
"IN_PROGRESS" => Some(Self::InProgress),
"ERROR" => Some(Self::Error),
_ => None,
}
}
}
}
/// Response message for the
/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProcessResponse {
/// The document payload, will populate fields based on the processor's
/// behavior.
#[prost(message, optional, tag = "1")]
pub document: ::core::option::Option<Document>,
/// The status of human review on the processed document.
#[prost(message, optional, tag = "3")]
pub human_review_status: ::core::option::Option<HumanReviewStatus>,
}
/// Request message for
/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchProcessRequest {
/// Required. The resource name of
/// [Processor][google.cloud.documentai.v1.Processor] or
/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
/// Format: `projects/{project}/locations/{location}/processors/{processor}`,
/// or
/// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The input documents for the
/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
/// method.
#[prost(message, optional, tag = "5")]
pub input_documents: ::core::option::Option<BatchDocumentsInputConfig>,
/// The output configuration for the
/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
/// method.
#[prost(message, optional, tag = "6")]
pub document_output_config: ::core::option::Option<DocumentOutputConfig>,
/// Whether human review should be skipped for this request. Default to
/// `false`.
#[prost(bool, tag = "4")]
pub skip_human_review: bool,
/// Inference-time options for the process API
#[prost(message, optional, tag = "7")]
pub process_options: ::core::option::Option<ProcessOptions>,
/// Optional. The labels with user-defined metadata for the request.
///
/// Label keys and values can be no longer than 63 characters
/// (Unicode codepoints) and can only contain lowercase letters, numeric
/// characters, underscores, and dashes. International characters are allowed.
/// Label values are optional. Label keys must start with a letter.
#[prost(btree_map = "string, string", tag = "9")]
pub labels: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
/// Response message for
/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct BatchProcessResponse {}
/// The long-running operation metadata for
/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchProcessMetadata {
/// The state of the current batch processing.
#[prost(enumeration = "batch_process_metadata::State", tag = "1")]
pub state: i32,
/// A message providing more details about the current state of processing.
/// For example, the error message if the operation is failed.
#[prost(string, tag = "2")]
pub state_message: ::prost::alloc::string::String,
/// The creation time of the operation.
#[prost(message, optional, tag = "3")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// The last update time of the operation.
#[prost(message, optional, tag = "4")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
/// The list of response details of each document.
#[prost(message, repeated, tag = "5")]
pub individual_process_statuses: ::prost::alloc::vec::Vec<
batch_process_metadata::IndividualProcessStatus,
>,
}
/// Nested message and enum types in `BatchProcessMetadata`.
pub mod batch_process_metadata {
/// The status of a each individual document in the batch process.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IndividualProcessStatus {
/// The source of the document, same as the
/// [input_gcs_source][google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]
/// field in the request when the batch process started.
#[prost(string, tag = "1")]
pub input_gcs_source: ::prost::alloc::string::String,
/// The status processing the document.
#[prost(message, optional, tag = "2")]
pub status: ::core::option::Option<super::super::super::super::rpc::Status>,
/// The Cloud Storage output destination (in the request as
/// [DocumentOutputConfig.GcsOutputConfig.gcs_uri][google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri])
/// of the processed document if it was successful, otherwise empty.
#[prost(string, tag = "3")]
pub output_gcs_destination: ::prost::alloc::string::String,
/// The status of human review on the processed document.
#[prost(message, optional, tag = "5")]
pub human_review_status: ::core::option::Option<super::HumanReviewStatus>,
}
/// Possible states of the batch processing operation.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum State {
/// The default value. This value is used if the state is omitted.
Unspecified = 0,
/// Request operation is waiting for scheduling.
Waiting = 1,
/// Request is being processed.
Running = 2,
/// The batch processing completed successfully.
Succeeded = 3,
/// The batch processing was being cancelled.
Cancelling = 4,
/// The batch processing was cancelled.
Cancelled = 5,
/// The batch processing has failed.
Failed = 6,
}
impl State {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
State::Unspecified => "STATE_UNSPECIFIED",
State::Waiting => "WAITING",
State::Running => "RUNNING",
State::Succeeded => "SUCCEEDED",
State::Cancelling => "CANCELLING",
State::Cancelled => "CANCELLED",
State::Failed => "FAILED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STATE_UNSPECIFIED" => Some(Self::Unspecified),
"WAITING" => Some(Self::Waiting),
"RUNNING" => Some(Self::Running),
"SUCCEEDED" => Some(Self::Succeeded),
"CANCELLING" => Some(Self::Cancelling),
"CANCELLED" => Some(Self::Cancelled),
"FAILED" => Some(Self::Failed),
_ => None,
}
}
}
}
/// Request message for the
/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
/// method. Some processor types may require the project be added to an
/// allowlist.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FetchProcessorTypesRequest {
/// Required. The location of processor types to list.
/// Format: `projects/{project}/locations/{location}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
}
/// Response message for the
/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FetchProcessorTypesResponse {
/// The list of processor types.
#[prost(message, repeated, tag = "1")]
pub processor_types: ::prost::alloc::vec::Vec<ProcessorType>,
}
/// Request message for the
/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
/// method. Some processor types may require the project be added to an
/// allowlist.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListProcessorTypesRequest {
/// Required. The location of processor types to list.
/// Format: `projects/{project}/locations/{location}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// The maximum number of processor types to return.
/// If unspecified, at most `100` processor types will be returned.
/// The maximum value is `500`. Values above `500` will be coerced to `500`.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// Used to retrieve the next page of results, empty if at the end of the list.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
/// Response message for the
/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListProcessorTypesResponse {
/// The processor types.
#[prost(message, repeated, tag = "1")]
pub processor_types: ::prost::alloc::vec::Vec<ProcessorType>,
/// Points to the next page, otherwise empty.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Request message for list all processors belongs to a project.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListProcessorsRequest {
/// Required. The parent (project and location) which owns this collection of
/// Processors. Format: `projects/{project}/locations/{location}`
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// The maximum number of processors to return.
/// If unspecified, at most `50` processors will be returned.
/// The maximum value is `100`. Values above `100` will be coerced to `100`.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// We will return the processors sorted by creation time. The page token
/// will point to the next processor.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
/// Response message for the
/// [ListProcessors][google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListProcessorsResponse {
/// The list of processors.
#[prost(message, repeated, tag = "1")]
pub processors: ::prost::alloc::vec::Vec<Processor>,
/// Points to the next processor, otherwise empty.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Request message for the
/// [GetProcessorType][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetProcessorTypeRequest {
/// Required. The processor type resource name.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request message for the
/// [GetProcessor][google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetProcessorRequest {
/// Required. The processor resource name.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request message for the
/// [GetProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetProcessorVersionRequest {
/// Required. The processor resource name.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request message for list all processor versions belongs to a processor.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListProcessorVersionsRequest {
/// Required. The parent (project, location and processor) to list all
/// versions. Format:
/// `projects/{project}/locations/{location}/processors/{processor}`
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// The maximum number of processor versions to return.
/// If unspecified, at most `10` processor versions will be returned.
/// The maximum value is `20`. Values above `20` will be coerced to `20`.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// We will return the processor versions sorted by creation time. The page
/// token will point to the next processor version.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
/// Response message for the
/// [ListProcessorVersions][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListProcessorVersionsResponse {
/// The list of processors.
#[prost(message, repeated, tag = "1")]
pub processor_versions: ::prost::alloc::vec::Vec<ProcessorVersion>,
/// Points to the next processor, otherwise empty.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Request message for the
/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteProcessorVersionRequest {
/// Required. The processor version resource name to be deleted.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// The long-running operation metadata for the
/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteProcessorVersionMetadata {
/// The basic metadata of the long-running operation.
#[prost(message, optional, tag = "1")]
pub common_metadata: ::core::option::Option<CommonOperationMetadata>,
}
/// Request message for the
/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeployProcessorVersionRequest {
/// Required. The processor version resource name to be deployed.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Response message for the
/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
/// method.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DeployProcessorVersionResponse {}
/// The long-running operation metadata for the
/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeployProcessorVersionMetadata {
/// The basic metadata of the long-running operation.
#[prost(message, optional, tag = "1")]
pub common_metadata: ::core::option::Option<CommonOperationMetadata>,
}
/// Request message for the
/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UndeployProcessorVersionRequest {
/// Required. The processor version resource name to be undeployed.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Response message for the
/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
/// method.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UndeployProcessorVersionResponse {}
/// The long-running operation metadata for the
/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UndeployProcessorVersionMetadata {
/// The basic metadata of the long-running operation.
#[prost(message, optional, tag = "1")]
pub common_metadata: ::core::option::Option<CommonOperationMetadata>,
}
/// Request message for the
/// [CreateProcessor][google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]
/// method. Notice this request is sent to a regionalized backend service. If the
/// [ProcessorType][google.cloud.documentai.v1.ProcessorType] isn't available in
/// that region, the creation fails.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateProcessorRequest {
/// Required. The parent (project and location) under which to create the
/// processor. Format: `projects/{project}/locations/{location}`
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. The processor to be created, requires
/// [Processor.type][google.cloud.documentai.v1.Processor.type] and
/// [Processor.display_name][google.cloud.documentai.v1.Processor.display_name]
/// to be set. Also, the
/// [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name]
/// field must be set if the processor is under CMEK.
#[prost(message, optional, tag = "2")]
pub processor: ::core::option::Option<Processor>,
}
/// Request message for the
/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteProcessorRequest {
/// Required. The processor resource name to be deleted.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// The long-running operation metadata for the
/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteProcessorMetadata {
/// The basic metadata of the long-running operation.
#[prost(message, optional, tag = "5")]
pub common_metadata: ::core::option::Option<CommonOperationMetadata>,
}
/// Request message for the
/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EnableProcessorRequest {
/// Required. The processor resource name to be enabled.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Response message for the
/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
/// method. Intentionally empty proto for adding fields in future.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct EnableProcessorResponse {}
/// The long-running operation metadata for the
/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EnableProcessorMetadata {
/// The basic metadata of the long-running operation.
#[prost(message, optional, tag = "5")]
pub common_metadata: ::core::option::Option<CommonOperationMetadata>,
}
/// Request message for the
/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DisableProcessorRequest {
/// Required. The processor resource name to be disabled.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Response message for the
/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
/// method. Intentionally empty proto for adding fields in future.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DisableProcessorResponse {}
/// The long-running operation metadata for the
/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DisableProcessorMetadata {
/// The basic metadata of the long-running operation.
#[prost(message, optional, tag = "5")]
pub common_metadata: ::core::option::Option<CommonOperationMetadata>,
}
/// Request message for the
/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetDefaultProcessorVersionRequest {
/// Required. The resource name of the
/// [Processor][google.cloud.documentai.v1.Processor] to change default
/// version.
#[prost(string, tag = "1")]
pub processor: ::prost::alloc::string::String,
/// Required. The resource name of child
/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as
/// default. Format:
/// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`
#[prost(string, tag = "2")]
pub default_processor_version: ::prost::alloc::string::String,
}
/// Response message for the
/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
/// method.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SetDefaultProcessorVersionResponse {}
/// The long-running operation metadata for the
/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetDefaultProcessorVersionMetadata {
/// The basic metadata of the long-running operation.
#[prost(message, optional, tag = "1")]
pub common_metadata: ::core::option::Option<CommonOperationMetadata>,
}
/// Request message for the
/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrainProcessorVersionRequest {
/// Required. The parent (project, location and processor) to create the new
/// version for. Format:
/// `projects/{project}/locations/{location}/processors/{processor}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. The processor version to be created.
#[prost(message, optional, tag = "2")]
pub processor_version: ::core::option::Option<ProcessorVersion>,
/// Optional. The schema the processor version will be trained with.
#[prost(message, optional, tag = "10")]
pub document_schema: ::core::option::Option<DocumentSchema>,
/// Optional. The input data used to train the
/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
#[prost(message, optional, tag = "4")]
pub input_data: ::core::option::Option<train_processor_version_request::InputData>,
/// Optional. The processor version to use as a base for training. This
/// processor version must be a child of `parent`. Format:
/// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
#[prost(string, tag = "8")]
pub base_processor_version: ::prost::alloc::string::String,
#[prost(oneof = "train_processor_version_request::ProcessorFlags", tags = "5, 12")]
pub processor_flags: ::core::option::Option<
train_processor_version_request::ProcessorFlags,
>,
}
/// Nested message and enum types in `TrainProcessorVersionRequest`.
pub mod train_processor_version_request {
/// The input data used to train a new
/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InputData {
/// The documents used for training the new version.
#[prost(message, optional, tag = "3")]
pub training_documents: ::core::option::Option<super::BatchDocumentsInputConfig>,
/// The documents used for testing the trained version.
#[prost(message, optional, tag = "4")]
pub test_documents: ::core::option::Option<super::BatchDocumentsInputConfig>,
}
/// Options to control the training of the Custom Document Extraction (CDE)
/// Processor.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CustomDocumentExtractionOptions {
/// Training method to use for CDE training.
#[prost(
enumeration = "custom_document_extraction_options::TrainingMethod",
tag = "3"
)]
pub training_method: i32,
}
/// Nested message and enum types in `CustomDocumentExtractionOptions`.
pub mod custom_document_extraction_options {
/// Training Method for CDE. `TRAINING_METHOD_UNSPECIFIED` will fall back to
/// `MODEL_BASED`.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum TrainingMethod {
Unspecified = 0,
ModelBased = 1,
TemplateBased = 2,
}
impl TrainingMethod {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
TrainingMethod::Unspecified => "TRAINING_METHOD_UNSPECIFIED",
TrainingMethod::ModelBased => "MODEL_BASED",
TrainingMethod::TemplateBased => "TEMPLATE_BASED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"TRAINING_METHOD_UNSPECIFIED" => Some(Self::Unspecified),
"MODEL_BASED" => Some(Self::ModelBased),
"TEMPLATE_BASED" => Some(Self::TemplateBased),
_ => None,
}
}
}
}
/// Options to control foundation model tuning of the processor.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FoundationModelTuningOptions {
/// Optional. The number of steps to run for model tuning. Valid values are
/// between 1 and 400. If not provided, recommended steps will be used.
#[prost(int32, tag = "2")]
pub train_steps: i32,
/// Optional. The multiplier to apply to the recommended learning rate. Valid
/// values are between 0.1 and 10. If not provided, recommended learning rate
/// will be used.
#[prost(float, tag = "3")]
pub learning_rate_multiplier: f32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum ProcessorFlags {
/// Options to control Custom Document Extraction (CDE) Processor.
#[prost(message, tag = "5")]
CustomDocumentExtractionOptions(CustomDocumentExtractionOptions),
/// Options to control foundation model tuning of a processor.
#[prost(message, tag = "12")]
FoundationModelTuningOptions(FoundationModelTuningOptions),
}
}
/// The response for
/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrainProcessorVersionResponse {
/// The resource name of the processor version produced by training.
#[prost(string, tag = "1")]
pub processor_version: ::prost::alloc::string::String,
}
/// The metadata that represents a processor version being created.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrainProcessorVersionMetadata {
/// The basic metadata of the long-running operation.
#[prost(message, optional, tag = "1")]
pub common_metadata: ::core::option::Option<CommonOperationMetadata>,
/// The training dataset validation information.
#[prost(message, optional, tag = "2")]
pub training_dataset_validation: ::core::option::Option<
train_processor_version_metadata::DatasetValidation,
>,
/// The test dataset validation information.
#[prost(message, optional, tag = "3")]
pub test_dataset_validation: ::core::option::Option<
train_processor_version_metadata::DatasetValidation,
>,
}
/// Nested message and enum types in `TrainProcessorVersionMetadata`.
pub mod train_processor_version_metadata {
/// The dataset validation information.
/// This includes any and all errors with documents and the dataset.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DatasetValidation {
/// The total number of document errors.
#[prost(int32, tag = "3")]
pub document_error_count: i32,
/// The total number of dataset errors.
#[prost(int32, tag = "4")]
pub dataset_error_count: i32,
/// Error information pertaining to specific documents. A maximum of 10
/// document errors will be returned.
/// Any document with errors will not be used throughout training.
#[prost(message, repeated, tag = "1")]
pub document_errors: ::prost::alloc::vec::Vec<
super::super::super::super::rpc::Status,
>,
/// Error information for the dataset as a whole. A maximum of 10 dataset
/// errors will be returned.
/// A single dataset error is terminal for training.
#[prost(message, repeated, tag = "2")]
pub dataset_errors: ::prost::alloc::vec::Vec<
super::super::super::super::rpc::Status,
>,
}
}
/// Request message for the
/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReviewDocumentRequest {
/// Required. The resource name of the
/// [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the
/// document will be reviewed with.
#[prost(string, tag = "1")]
pub human_review_config: ::prost::alloc::string::String,
/// Whether the validation should be performed on the ad-hoc review request.
#[prost(bool, tag = "3")]
pub enable_schema_validation: bool,
/// The priority of the human review task.
#[prost(enumeration = "review_document_request::Priority", tag = "5")]
pub priority: i32,
/// The document schema of the human review task.
#[prost(message, optional, tag = "6")]
pub document_schema: ::core::option::Option<DocumentSchema>,
/// The document payload.
#[prost(oneof = "review_document_request::Source", tags = "4")]
pub source: ::core::option::Option<review_document_request::Source>,
}
/// Nested message and enum types in `ReviewDocumentRequest`.
pub mod review_document_request {
/// The priority level of the human review task.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Priority {
/// The default priority level.
Default = 0,
/// The urgent priority level. The labeling manager should allocate labeler
/// resource to the urgent task queue to respect this priority level.
Urgent = 1,
}
impl Priority {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Priority::Default => "DEFAULT",
Priority::Urgent => "URGENT",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"DEFAULT" => Some(Self::Default),
"URGENT" => Some(Self::Urgent),
_ => None,
}
}
}
/// The document payload.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Source {
/// An inline document proto.
#[prost(message, tag = "4")]
InlineDocument(super::Document),
}
}
/// Response message for the
/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReviewDocumentResponse {
/// The Cloud Storage uri for the human reviewed document if the review is
/// succeeded.
#[prost(string, tag = "1")]
pub gcs_destination: ::prost::alloc::string::String,
/// The state of the review operation.
#[prost(enumeration = "review_document_response::State", tag = "2")]
pub state: i32,
/// The reason why the review is rejected by reviewer.
#[prost(string, tag = "3")]
pub rejection_reason: ::prost::alloc::string::String,
}
/// Nested message and enum types in `ReviewDocumentResponse`.
pub mod review_document_response {
/// Possible states of the review operation.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum State {
/// The default value. This value is used if the state is omitted.
Unspecified = 0,
/// The review operation is rejected by the reviewer.
Rejected = 1,
/// The review operation is succeeded.
Succeeded = 2,
}
impl State {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
State::Unspecified => "STATE_UNSPECIFIED",
State::Rejected => "REJECTED",
State::Succeeded => "SUCCEEDED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STATE_UNSPECIFIED" => Some(Self::Unspecified),
"REJECTED" => Some(Self::Rejected),
"SUCCEEDED" => Some(Self::Succeeded),
_ => None,
}
}
}
}
/// The long-running operation metadata for the
/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReviewDocumentOperationMetadata {
/// The basic metadata of the long-running operation.
#[prost(message, optional, tag = "5")]
pub common_metadata: ::core::option::Option<CommonOperationMetadata>,
/// The Crowd Compute question ID.
#[prost(string, tag = "6")]
pub question_id: ::prost::alloc::string::String,
}
/// Evaluates the given
/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] against the
/// supplied documents.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EvaluateProcessorVersionRequest {
/// Required. The resource name of the
/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to
/// evaluate.
/// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
#[prost(string, tag = "1")]
pub processor_version: ::prost::alloc::string::String,
/// Optional. The documents used in the evaluation. If unspecified, use the
/// processor's dataset as evaluation input.
#[prost(message, optional, tag = "3")]
pub evaluation_documents: ::core::option::Option<BatchDocumentsInputConfig>,
}
/// Metadata of the
/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EvaluateProcessorVersionMetadata {
/// The basic metadata of the long-running operation.
#[prost(message, optional, tag = "1")]
pub common_metadata: ::core::option::Option<CommonOperationMetadata>,
}
/// Response of the
/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EvaluateProcessorVersionResponse {
/// The resource name of the created evaluation.
#[prost(string, tag = "2")]
pub evaluation: ::prost::alloc::string::String,
}
/// Retrieves a specific Evaluation.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetEvaluationRequest {
/// Required. The resource name of the
/// [Evaluation][google.cloud.documentai.v1.Evaluation] to get.
/// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Retrieves a list of evaluations for a given
/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListEvaluationsRequest {
/// Required. The resource name of the
/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list
/// evaluations for.
/// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// The standard list page size.
/// If unspecified, at most `5` evaluations are returned.
/// The maximum value is `100`. Values above `100` are coerced to `100`.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// A page token, received from a previous `ListEvaluations` call.
/// Provide this to retrieve the subsequent page.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
/// The response from `ListEvaluations`.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListEvaluationsResponse {
/// The evaluations requested.
#[prost(message, repeated, tag = "1")]
pub evaluations: ::prost::alloc::vec::Vec<Evaluation>,
/// A token, which can be sent as `page_token` to retrieve the next page.
/// If this field is omitted, there are no subsequent pages.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod document_processor_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// Service to call Document AI to process documents according to the
/// processor's definition. Processors are built using state-of-the-art Google
/// AI such as natural language, computer vision, and translation to extract
/// structured information from unstructured or semi-structured documents.
#[derive(Debug, Clone)]
pub struct DocumentProcessorServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> DocumentProcessorServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> DocumentProcessorServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
DocumentProcessorServiceClient::new(
InterceptedService::new(inner, interceptor),
)
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Processes a single document.
pub async fn process_document(
&mut self,
request: impl tonic::IntoRequest<super::ProcessRequest>,
) -> std::result::Result<
tonic::Response<super::ProcessResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/ProcessDocument",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"ProcessDocument",
),
);
self.inner.unary(req, path, codec).await
}
/// LRO endpoint to batch process many documents. The output is written
/// to Cloud Storage as JSON in the [Document] format.
pub async fn batch_process_documents(
&mut self,
request: impl tonic::IntoRequest<super::BatchProcessRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/BatchProcessDocuments",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"BatchProcessDocuments",
),
);
self.inner.unary(req, path, codec).await
}
/// Fetches processor types. Note that we don't use
/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
/// here, because it isn't paginated.
pub async fn fetch_processor_types(
&mut self,
request: impl tonic::IntoRequest<super::FetchProcessorTypesRequest>,
) -> std::result::Result<
tonic::Response<super::FetchProcessorTypesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/FetchProcessorTypes",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"FetchProcessorTypes",
),
);
self.inner.unary(req, path, codec).await
}
/// Lists the processor types that exist.
pub async fn list_processor_types(
&mut self,
request: impl tonic::IntoRequest<super::ListProcessorTypesRequest>,
) -> std::result::Result<
tonic::Response<super::ListProcessorTypesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/ListProcessorTypes",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"ListProcessorTypes",
),
);
self.inner.unary(req, path, codec).await
}
/// Gets a processor type detail.
pub async fn get_processor_type(
&mut self,
request: impl tonic::IntoRequest<super::GetProcessorTypeRequest>,
) -> std::result::Result<tonic::Response<super::ProcessorType>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/GetProcessorType",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"GetProcessorType",
),
);
self.inner.unary(req, path, codec).await
}
/// Lists all processors which belong to this project.
pub async fn list_processors(
&mut self,
request: impl tonic::IntoRequest<super::ListProcessorsRequest>,
) -> std::result::Result<
tonic::Response<super::ListProcessorsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/ListProcessors",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"ListProcessors",
),
);
self.inner.unary(req, path, codec).await
}
/// Gets a processor detail.
pub async fn get_processor(
&mut self,
request: impl tonic::IntoRequest<super::GetProcessorRequest>,
) -> std::result::Result<tonic::Response<super::Processor>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/GetProcessor",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"GetProcessor",
),
);
self.inner.unary(req, path, codec).await
}
/// Trains a new processor version.
/// Operation metadata is returned as
/// [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata].
pub async fn train_processor_version(
&mut self,
request: impl tonic::IntoRequest<super::TrainProcessorVersionRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/TrainProcessorVersion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"TrainProcessorVersion",
),
);
self.inner.unary(req, path, codec).await
}
/// Gets a processor version detail.
pub async fn get_processor_version(
&mut self,
request: impl tonic::IntoRequest<super::GetProcessorVersionRequest>,
) -> std::result::Result<
tonic::Response<super::ProcessorVersion>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/GetProcessorVersion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"GetProcessorVersion",
),
);
self.inner.unary(req, path, codec).await
}
/// Lists all versions of a processor.
pub async fn list_processor_versions(
&mut self,
request: impl tonic::IntoRequest<super::ListProcessorVersionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListProcessorVersionsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/ListProcessorVersions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"ListProcessorVersions",
),
);
self.inner.unary(req, path, codec).await
}
/// Deletes the processor version, all artifacts under the processor version
/// will be deleted.
pub async fn delete_processor_version(
&mut self,
request: impl tonic::IntoRequest<super::DeleteProcessorVersionRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/DeleteProcessorVersion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"DeleteProcessorVersion",
),
);
self.inner.unary(req, path, codec).await
}
/// Deploys the processor version.
pub async fn deploy_processor_version(
&mut self,
request: impl tonic::IntoRequest<super::DeployProcessorVersionRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/DeployProcessorVersion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"DeployProcessorVersion",
),
);
self.inner.unary(req, path, codec).await
}
/// Undeploys the processor version.
pub async fn undeploy_processor_version(
&mut self,
request: impl tonic::IntoRequest<super::UndeployProcessorVersionRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/UndeployProcessorVersion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"UndeployProcessorVersion",
),
);
self.inner.unary(req, path, codec).await
}
/// Creates a processor from the
/// [ProcessorType][google.cloud.documentai.v1.ProcessorType] provided. The
/// processor will be at `ENABLED` state by default after its creation. Note
/// that this method requires the `documentai.processors.create` permission on
/// the project, which is highly privileged. A user or service account with
/// this permission can create new processors that can interact with any gcs
/// bucket in your project.
pub async fn create_processor(
&mut self,
request: impl tonic::IntoRequest<super::CreateProcessorRequest>,
) -> std::result::Result<tonic::Response<super::Processor>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/CreateProcessor",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"CreateProcessor",
),
);
self.inner.unary(req, path, codec).await
}
/// Deletes the processor, unloads all deployed model artifacts if it was
/// enabled and then deletes all artifacts associated with this processor.
pub async fn delete_processor(
&mut self,
request: impl tonic::IntoRequest<super::DeleteProcessorRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/DeleteProcessor",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"DeleteProcessor",
),
);
self.inner.unary(req, path, codec).await
}
/// Enables a processor
pub async fn enable_processor(
&mut self,
request: impl tonic::IntoRequest<super::EnableProcessorRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/EnableProcessor",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"EnableProcessor",
),
);
self.inner.unary(req, path, codec).await
}
/// Disables a processor
pub async fn disable_processor(
&mut self,
request: impl tonic::IntoRequest<super::DisableProcessorRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/DisableProcessor",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"DisableProcessor",
),
);
self.inner.unary(req, path, codec).await
}
/// Set the default (active) version of a
/// [Processor][google.cloud.documentai.v1.Processor] that will be used in
/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
/// and
/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
pub async fn set_default_processor_version(
&mut self,
request: impl tonic::IntoRequest<super::SetDefaultProcessorVersionRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/SetDefaultProcessorVersion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"SetDefaultProcessorVersion",
),
);
self.inner.unary(req, path, codec).await
}
/// Send a document for Human Review. The input document should be processed by
/// the specified processor.
pub async fn review_document(
&mut self,
request: impl tonic::IntoRequest<super::ReviewDocumentRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/ReviewDocument",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"ReviewDocument",
),
);
self.inner.unary(req, path, codec).await
}
/// Evaluates a ProcessorVersion against annotated documents, producing an
/// Evaluation.
pub async fn evaluate_processor_version(
&mut self,
request: impl tonic::IntoRequest<super::EvaluateProcessorVersionRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/EvaluateProcessorVersion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"EvaluateProcessorVersion",
),
);
self.inner.unary(req, path, codec).await
}
/// Retrieves a specific evaluation.
pub async fn get_evaluation(
&mut self,
request: impl tonic::IntoRequest<super::GetEvaluationRequest>,
) -> std::result::Result<tonic::Response<super::Evaluation>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/GetEvaluation",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"GetEvaluation",
),
);
self.inner.unary(req, path, codec).await
}
/// Retrieves a set of evaluations for a given processor version.
pub async fn list_evaluations(
&mut self,
request: impl tonic::IntoRequest<super::ListEvaluationsRequest>,
) -> std::result::Result<
tonic::Response<super::ListEvaluationsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.documentai.v1.DocumentProcessorService/ListEvaluations",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.documentai.v1.DocumentProcessorService",
"ListEvaluations",
),
);
self.inner.unary(req, path, codec).await
}
}
}