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
//! v004010 repesents all entities of the 004010 specification.
use crate::util::Parser;
use nom::combinator::opt;
use nom::combinator::peek;
use nom::multi::many0;
use nom::IResult;
pub use segment::*;
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
use std::fmt::Display;
use x12_types_macros::DisplayX12;
mod segment;
#[cfg(test)]
mod test_204;
#[cfg(test)]
mod test_301;
#[cfg(test)]
mod test_309;
#[cfg(test)]
mod test_310;
#[cfg(test)]
mod test_315;
#[cfg(test)]
mod test_404;
#[cfg(test)]
mod test_998;
#[cfg(test)]
mod test_segments;
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq)]
pub struct Transmission<T> {
pub isa: ISA,
pub functional_group: Vec<FunctionalGroup<T>>,
pub iea: IEA,
}
impl<'a, T: Default + Parser<&'a str, T, nom::error::Error<&'a str>>>
Parser<&'a str, Transmission<T>, nom::error::Error<&'a str>> for Transmission<T>
{
fn parse(input: &'a str) -> IResult<&'a str, Transmission<T>> {
let mut output = Transmission::default();
let (input, obj) = ISA::parse(input)?;
output.isa = obj;
// functional group
let (input, gs) = GS::parse(input)?;
let (input, t_obj) = T::parse(input)?;
let (input, ge) = GE::parse(input)?;
let fg = FunctionalGroup {
gs,
segments: vec![t_obj],
ge,
};
output.functional_group.push(fg);
let (input, obj) = IEA::parse(input)?;
output.iea = obj;
Ok((input, output))
}
}
impl<T: Display> Display for Transmission<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut lines = vec![];
lines.push(format!("{}", self.isa));
for fg in &self.functional_group {
lines.push(format!("{}", fg.gs));
for segment in &fg.segments {
lines.push(format!("{}", segment));
}
lines.push(format!("{}", fg.ge));
}
lines.push(format!("{}", self.iea));
let all = lines.join("");
write!(f, "{all}")
}
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq)]
pub struct FunctionalGroup<T> {
pub gs: GS,
pub segments: Vec<T>,
pub ge: GE,
}
/// 204 - Motor Carrier Load Tender
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the Motor Carrier Load Tender Transaction Set (204) for use within the context of an Electronic Data Interchange (EDI) environment. This transaction set can be used to allow shippers or other interested parties to offer (tender) a shipment to a full load (truckload) motor carrier including detailed scheduling, equipment requirements, commodities, and shipping instructions pertinent to a load tender. It is not to be used to provide a motor carrier with data relative to a Less-than-Truckload bill of lading, pick-up notification, or manifest.
///
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 0010 | ST | Transaction Set Header | M | 1
/// 0020 | B2 | Beginning Segment for Shipment Information Transaction | M | 1
/// 0030 | B2A | Set Purpose | M | 1
/// 0080 | L11 | Business Instructions and Reference Number | O | 50
/// 0090 | G62 | Date/Time | O | 1
/// 0100 | MS3 | Interline Information | O | 1
/// 0110 | AT5 | Bill of Lading Handling Requirements | O | 6
/// 0120 | PLD | Pallet Information | O | 1
/// 0125 | LH6 | Hazardous Certification | O | 6
/// 0130 | NTE | Note/Special Instruction | O | 10
/// LOOP ID - 0100 | 5
/// 0100 -> 0140 | N1 | Name | O | 1
/// 0100 -> 0150 | N2 | Additional Name Information | O | 1
/// 0100 -> 0160 | N3 | Address Information | O | 2
/// 0100 -> 0170 | N4 | Geographic Location | O | 1
/// 0100 -> 0180 | L11 | Business Instructions and Reference Number | O | 1
/// 0100 -> 0190 | G61 | Contact | O | 3
/// LOOP ID - 0200 | 10
/// 0200 -> 0200 | N7 | Equipment Details | O | 1
/// 0200 -> 0203 | N7A | Accessorial Equipment Details | O | 1
/// 0200 -> 0205 | N7B | Additional Equipment Details | O | 1
/// 0200 -> 0208 | MEA | Measurements | O | 1
/// 0200 -> 0210 | M7 | Seal Numbers | O | 2
/// LOOP ID - 0300 | 999
/// 0300 -> 0010 | S5 | Stop Off Details | M | 1
/// 0300 -> 0020 | L11 | Business Instructions and Reference Number | O | 50
/// 0300 -> 0030 | G62 | Date/Time | O | 2
/// 0300 -> 0040 | AT8 | Shipment Weight, Packaging and Quantity Data | O | 1
/// 0300 -> 0050 | LAD | Lading Detail | O | 999
/// 0300 -> 0060 | AT5 | Bill of Lading Handling Requirements | O | 6
/// 0300 -> 0063 | PLD | Pallet Information | O | 1
/// 0300 -> 0065 | NTE | Note/Special Instruction | O | 20
/// 0300 -> LOOP ID - 0310 | 1 |
/// 0300 -> 0310 -> 0070 | N1 | Name | O | 1
/// 0300 -> 0310 -> 0080 | N2 | Additional Name Information | O | 1
/// 0300 -> 0310 -> 0090 | N3 | Address Information | O | 2
/// 0300 -> 0310 -> 0100 | N4 | Geographic Location | O | 1
/// 0300 -> 0310 -> 0120 | G61 | Contact | O | 3
/// 0300 -> LOOP ID - 0320 | 99 |
/// 0300 -> 0320 -> 0130 | L5 | Description, Marks and Numbers | O | 1
/// 0300 -> 0320 -> 0135 | AT8 | Shipment Weight, Packaging and Quantity Data | O | 1
/// 0300 -> 0320 -> LOOP ID - 0325 | 99 | |
/// 0300 -> 0320 -> 0325 -> 0140 | G61 | Contact | O | 1
/// 0300 -> 0320 -> 0325 -> 0141 | L11 | Business Instructions and Reference Number | O | 5
/// 0300 -> 0320 -> 0325 -> 0142 | LH6 | Hazardous Certification | O | 6
/// 0300 -> 0320 -> 0325 -> LOOP ID - 0330 | 25 | | |
/// 0300 -> 0320 -> 0325 -> 0330 -> 0143 | LH1 | Hazardous Identification Information | O | 1
/// 0300 -> 0320 -> 0325 -> 0330 -> 0144 | LH2 | Hazardous Classification Information | O | 4
/// 0300 -> 0320 -> 0325 -> 0330 -> 0145 | LH3 | Hazardous Material Shipping Name | O | 10
/// 0300 -> 0320 -> 0325 -> 0330 -> 0146 | LFH | Freeform Hazardous Material Information | O | 20
/// 0300 -> 0320 -> 0325 -> 0330 -> 0147 | LEP | EPA Required Data | O | 3
/// 0300 -> 0320 -> 0325 -> 0330 -> 0148 | LH4 | Canadian Dangerous Requirements | O | 1
/// 0300 -> 0320 -> 0325 -> 0330 -> 0149 | LHT | Transborder Hazardous Requirements | O | 3
/// 0300 -> LOOP ID - 0350 | 999 |
/// 0300 -> 0350 -> 0150 | OID | Order Identification Detail | O | 1
/// 0300 -> 0350 -> 0160 | G62 | Date/Time | O | 2
/// 0300 -> 0350 -> 0180 | LAD | Lading Detail | O | 999
/// 0300 -> 0350 -> LOOP ID - 0360 | 99 | |
/// 0300 -> 0350 -> 0360 -> 0190 | L5 | Description, Marks and Numbers | O | 1
/// 0300 -> 0350 -> 0360 -> 0195 | AT8 | Shipment Weight, Packaging and Quantity Data | O | 1
/// 0300 -> 0350 -> 0360 -> LOOP ID - 0365 | 99 | | |
/// 0300 -> 0350 -> 0360 -> 0365 -> 0200 | G61 | Contact | O | 1
/// 0300 -> 0350 -> 0360 -> 0365 -> 0201 | L11 | Business Instructions and Reference Number | O | 5
/// 0300 -> 0350 -> 0360 -> 0365 -> 0202 | LH6 | Hazardous Certification | O | 6
/// 0300 -> 0350 -> 0360 -> 0365 -> LOOP ID - 0370 | 25 | | | |
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0203 | LH1 | Hazardous Identification Information | O | 1
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0204 | LH2 | Hazardous Classification Information | O | 4
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0205 | LH3 | Hazardous Material Shipping Name | O | 10
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0206 | LFH | Freeform Hazardous Material Information | O | 20
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0207 | LEP | EPA Required Data | O | 3
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0208 | LH4 | Canadian Dangerous Requirements | O | 1
/// 0300 -> 0350 -> 0360 -> 0365 -> 0370 -> 0209 | LHT | Transborder Hazardous Requirements | O | 3
/// 0300 -> LOOP ID - 0380 | 10 |
/// 0300 -> 0380 -> 0210 | N7 | Equipment Details | O | 1
/// 0300 -> 0380 -> 0220 | N7A | Accessorial Equipment Details | O | 1
/// 0300 -> 0380 -> 0230 | N7B | Additional Equipment Details | O | 1
/// 0300 -> 0380 -> 0240 | MEA | Measurements | O | 1
/// 0300 -> 0380 -> 0250 | M7 | Seal Numbers | O | 2
/// 9010 | L3 | Total Weight and Charges | O | 1
/// 9020 | SE | Transaction Set Trailer | M | 1
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _204 {
pub st: ST,
pub b2: B2,
pub b2a: B2A,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub l11: Vec<L11>,
#[serde(skip_serializing_if = "Option::is_none")]
pub g62: Option<G62>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ms3: Option<MS3>,
#[serde(skip_serializing_if = "Option::is_none")]
pub at5: Option<AT5>,
#[serde(skip_serializing_if = "Option::is_none")]
pub pld: Option<PLD>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub lh6: Vec<LH6>,
#[serde(skip_serializing_if = "Option::is_none")]
pub nte: Option<NTE>,
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub loop_100: Vec<_204Loop100>,
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub loop_200: Vec<_204Loop200>,
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub loop_300: Vec<_204Loop300>,
#[serde(skip_serializing_if = "Option::is_none")]
pub l3: Option<L3>,
pub se: SE,
}
impl<'a> Parser<&'a str, _204, nom::error::Error<&'a str>> for _204 {
fn parse(input: &'a str) -> IResult<&'a str, _204> {
let mut output = _204::default();
let (rest, obj) = ST::parse(input)?;
output.st = obj;
let (rest, obj) = B2::parse(rest)?;
output.b2 = obj;
let (rest, obj) = B2A::parse(rest)?;
output.b2a = obj;
let (rest, obj) = many0(L11::parse)(rest)?;
output.l11 = obj;
let (rest, obj) = opt(G62::parse)(rest)?;
output.g62 = obj;
let (rest, obj) = opt(MS3::parse)(rest)?;
output.ms3 = obj;
let (rest, obj) = opt(AT5::parse)(rest)?;
output.at5 = obj;
let (rest, obj) = opt(PLD::parse)(rest)?;
output.pld = obj;
let (rest, obj) = many0(LH6::parse)(rest)?;
output.lh6 = obj;
let (rest, obj) = opt(NTE::parse)(rest)?;
output.nte = obj;
// loop 100
let mut loop_100 = vec![];
let mut loop_rest = rest;
while peek(opt(N1::parse))(loop_rest)?.1.is_some() {
let (rest, n1) = opt(N1::parse)(loop_rest)?;
let (rest, n2) = opt(N2::parse)(rest)?;
let (rest, n3) = many0(N3::parse)(rest)?;
let (rest, n4) = opt(N4::parse)(rest)?;
let (rest, l11) = opt(L11::parse)(rest)?;
let (rest, g61) = many0(G61::parse)(rest)?;
loop_rest = rest;
loop_100.push(_204Loop100 {
n1,
n2,
n3,
n4,
l11,
g61,
});
}
let rest = loop_rest;
output.loop_100 = loop_100;
// loop 200
let mut loop_200 = vec![];
let mut loop_rest = rest;
while peek(opt(N7::parse))(loop_rest)?.1.is_some() {
let (rest, n7) = opt(N7::parse)(loop_rest)?;
let (rest, n7a) = opt(N7A::parse)(rest)?;
let (rest, n7b) = opt(N7B::parse)(rest)?;
let (rest, mea) = opt(MEA::parse)(rest)?;
let (rest, m7) = opt(M7::parse)(rest)?;
loop_rest = rest;
loop_200.push(_204Loop200 {
n7,
n7a,
n7b,
mea,
m7,
});
}
let rest = loop_rest;
output.loop_200 = loop_200;
// loop 300
let mut loop_300 = vec![];
let mut loop_rest = rest;
while peek(opt(S5::parse))(loop_rest)?.1.is_some() {
let (rest, s5) = S5::parse(loop_rest)?;
let (rest, l11) = many0(L11::parse)(rest)?;
let (rest, g62) = many0(G62::parse)(rest)?;
let (rest, at8) = opt(AT8::parse)(rest)?;
let (rest, lad) = many0(LAD::parse)(rest)?;
let (rest, at5) = many0(AT5::parse)(rest)?;
let (rest, pld) = opt(PLD::parse)(rest)?;
let (rest, nte) = many0(NTE::parse)(rest)?;
loop_rest = rest;
// loop 310
let mut loop_310 = vec![];
while peek(opt(N1::parse))(loop_rest)?.1.is_some() {
let (rest, n1) = opt(N1::parse)(loop_rest)?;
let (rest, n2) = opt(N2::parse)(rest)?;
let (rest, n3) = many0(N3::parse)(rest)?;
let (rest, n4) = opt(N4::parse)(rest)?;
let (rest, g61) = many0(G61::parse)(rest)?;
loop_rest = rest;
loop_310.push(_204Loop310 {
n1,
n2,
n3,
n4,
g61,
});
}
// loop 320
let mut loop_320 = vec![];
while peek(opt(L5::parse))(loop_rest)?.1.is_some()
|| peek(opt(LH1::parse))(loop_rest)?.1.is_some()
{
let (rest, l5) = opt(L5::parse)(loop_rest)?;
let (rest, at8) = opt(AT8::parse)(rest)?;
loop_rest = rest;
// loop 325
let mut loop_325 = vec![];
while peek(opt(G61::parse))(loop_rest)?.1.is_some()
|| peek(opt(LH1::parse))(loop_rest)?.1.is_some()
{
let (rest, g61) = opt(G61::parse)(loop_rest)?;
let (rest, l11) = many0(L11::parse)(rest)?;
let (rest, lh6) = opt(LH6::parse)(rest)?;
loop_rest = rest;
// loop 330
let mut loop_330 = vec![];
while peek(opt(LH1::parse))(loop_rest)?.1.is_some() {
let (rest, lh1) = opt(LH1::parse)(loop_rest)?;
let (rest, lh2) = many0(LH2::parse)(rest)?;
let (rest, lh3) = many0(LH3::parse)(rest)?;
let (rest, lfh) = many0(LFH::parse)(rest)?;
let (rest, lep) = many0(LEP::parse)(rest)?;
let (rest, lh4) = opt(LH4::parse)(rest)?;
let (rest, lht) = many0(LHT::parse)(rest)?;
loop_rest = rest;
loop_330.push(_204Loop330 {
lh1,
lh2,
lh3,
lfh,
lep,
lh4,
lht,
});
}
loop_325.push(_204Loop325 {
g61,
l11,
lh6,
loop_330,
});
}
loop_320.push(_204Loop320 { l5, at8, loop_325 });
}
// loop 380
let mut loop_380 = vec![];
while peek(opt(N7::parse))(loop_rest)?.1.is_some() {
let (rest, n7) = opt(N7::parse)(loop_rest)?;
let (rest, n7a) = opt(N7A::parse)(rest)?;
let (rest, n7b) = opt(N7B::parse)(rest)?;
let (rest, mea) = opt(MEA::parse)(rest)?;
let (rest, m7) = opt(M7::parse)(rest)?;
loop_rest = rest;
loop_380.push(_204Loop380 {
n7,
n7a,
n7b,
mea,
m7,
});
}
loop_300.push(_204Loop300 {
s5,
l11,
g62,
at8,
lad,
at5,
pld,
nte,
loop_310,
loop_320,
loop_350: vec![],
loop_380,
});
}
let rest = loop_rest;
output.loop_300 = loop_300;
let (rest, obj) = opt(L3::parse)(rest)?;
output.l3 = obj;
let (rest, obj) = SE::parse(rest)?;
output.se = obj;
Ok((rest, output))
}
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _204Loop100 {
pub n1: Option<N1>,
pub n2: Option<N2>,
pub n3: Vec<N3>,
pub n4: Option<N4>,
pub l11: Option<L11>,
pub g61: Vec<G61>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _204Loop200 {
pub n7: Option<N7>,
pub n7a: Option<N7A>,
pub n7b: Option<N7B>,
pub mea: Option<MEA>,
pub m7: Option<M7>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _204Loop300 {
pub s5: S5,
pub l11: Vec<L11>,
pub g62: Vec<G62>,
pub at8: Option<AT8>,
pub lad: Vec<LAD>,
pub at5: Vec<AT5>,
pub pld: Option<PLD>,
pub nte: Vec<NTE>,
pub loop_310: Vec<_204Loop310>,
pub loop_320: Vec<_204Loop320>,
pub loop_350: Vec<_204Loop350>,
pub loop_380: Vec<_204Loop380>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _204Loop310 {
pub n1: Option<N1>,
pub n2: Option<N2>,
pub n3: Vec<N3>,
pub n4: Option<N4>,
pub g61: Vec<G61>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _204Loop320 {
pub l5: Option<L5>,
pub at8: Option<AT8>,
pub loop_325: Vec<_204Loop325>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _204Loop325 {
pub g61: Option<G61>,
pub l11: Vec<L11>,
pub lh6: Option<LH6>,
pub loop_330: Vec<_204Loop330>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _204Loop330 {
pub lh1: Option<LH1>,
pub lh2: Vec<LH2>,
pub lh3: Vec<LH3>,
pub lfh: Vec<LFH>,
pub lep: Vec<LEP>,
pub lh4: Option<LH4>,
pub lht: Vec<LHT>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _204Loop350 {
pub oid: Option<OID>,
pub g62: Vec<G62>,
pub lad: Vec<LAD>,
pub loop_360: Vec<_204Loop360>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _204Loop360 {
pub l5: Option<L5>,
pub at8: Option<AT8>,
pub loop_365: Vec<_204Loop365>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _204Loop365 {
pub g61: Option<G61>,
pub l11: Vec<L11>,
pub lh6: Vec<LH6>,
pub loop_370: Vec<_204Loop370>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _204Loop370 {
pub lh1: Option<LH1>,
pub lh2: Vec<LH2>,
pub lh3: Vec<LH3>,
pub lfh: Vec<LFH>,
pub lep: Vec<LEP>,
pub lh4: Option<LH4>,
pub lht: Vec<LHT>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _204Loop380 {
pub n7: Option<N7>,
pub n7a: Option<N7A>,
pub n7b: Option<N7B>,
pub mea: Option<MEA>,
pub m7: Option<M7>,
}
/// 214 - Transportation Carrier Shipment Status Message
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the Transportation Carrier Shipment Status Message Transaction Set (214) for use within the context of an Electronic Data Interchange (EDI) environment. This transaction set can be used by a transportation carrier to provide shippers, consignees, and their agents with the status of shipments in terms of dates, times, locations, route, identifying numbers, and conveyance.
///
/// POS | ID | NAME | REQ | MAX | REPEAT
/// 0010 | ST | Transaction Set Header | M | 1
/// 0020 | B10 | Beginning Segment for Transportation Carrier Shipment Status Message | M | 1
/// 0030 | L11 | Business Instructions and Reference Number | O | 300
/// 0035 | MAN | Marks and Numbers | O | 9999
/// 0040 | K1 | Remarks | O | 10
/// LOOP ID - 0100 | 10
/// 0100 -> 0050 | N1 | Name | O | 1
/// 0100 -> 0060 | N2 | Additional Name Information | O | 1
/// 0100 -> 0070 | N3 | Address Information | O | 2
/// 0100 -> 0080 | N4 | Geographic Location | O | 1
/// 0100 -> 0090 | G61 | Contact | O | 1
/// 0100 -> 0100 | G62 | Date/Time | O | 1
/// 0100 -> 0110 | L11 | Business Instructions and Reference Number | O | 10
/// 0120 | MS3 | Interline Information | O | 12
/// LOOP ID - 0200 | 999999
/// 0200 -> 0130 | LX | Assigned Number | O | 1
/// 0200 -> LOOP ID - 0205 | 10
/// 0200 -> 0205 -> 0140 | AT7 | Shipment Status Details | O | 1
/// 0200 -> 0205 -> 0143 | MS1 | Equipment, Shipment, or Real Property Location | O | 1
/// 0200 -> 0205 -> 0146 | MS2 | Equipment or Container Owner and Type | O | 1
/// 0200 -> 0150 | L11 | Business Instructions and Reference Number | O | 10
/// 0200 -> 0155 | MAN | Marks and Numbers | O | 9999
/// 0200 -> 0160 | Q7 | Lading Exception Code | O | 10
/// 0200 -> 0170 | K1 | Remarks | O | 10
/// 0200 -> 0180 | AT5 | Bill of Lading Handling Requirements | O | 10
/// 0200 -> 0200 | AT8 | Shipment Weight, Packaging and Quantity Data | O | 10
/// 0200 -> LOOP ID - 0210 | 999999
/// 0200 -> 0210 -> 0210 | CD3 | Carton (Package) Detail | O | 1
/// 0200 -> 0210 -> 0220 | L11 | Business Instructions and Reference Number | O | 20
/// 0200 -> 0210 -> LOOP ID - 0215 | 10
/// 0200 -> 0210 -> 0215 -> 0230 | AT7 | Shipment Status Details | O | 1
/// 0200 -> 0210 -> 0215 -> 0233 | MS1 | Equipment, Shipment, or Real Property Location | O | 1
/// 0200 -> 0210 -> 0215 -> 0236 | MS2 | Equipment or Container Owner and Type | O | 1
/// 0200 -> 0210 -> 0240 | NM1 | Individual or Organizational Name | O | 1
/// 0200 -> 0210 -> 0250 | Q7 | Lading Exception Code | O | 10
/// 0200 -> 0210 -> 0260 | AT8 | Shipment Weight, Packaging and Quantity Data | O | 1
/// 0200 -> 0210 -> 0265 | MAN | Marks and Numbers | O | 9999
/// 0200 -> 0210 -> LOOP ID - 0220 | 999999
/// 0200 -> 0210 -> 0220 -> 0270 | N1 | Name | O | 1
/// 0200 -> 0210 -> 0220 -> 0280 | N2 | Additional Name Information | O | 1
/// 0200 -> 0210 -> 0220 -> 0290 | N3 | Address Information | O | 3
/// 0200 -> 0210 -> 0220 -> 0300 | N4 | Geographic Location | O | 1
/// 0200 -> 0210 -> 0220 -> 0310 | L11 | Business Instructions and Reference Number | O | 10
/// 0200 -> LOOP ID - 0230 | 999999
/// 0200 -> 0230 -> 0320 | PRF | Purchase Order Reference | O | 1
/// 0200 -> 0230 -> LOOP ID - 0231 | 999999
/// 0200 -> 0230 -> 0231 -> 0330 | N1 | Name | O | 1
/// 0200 -> 0230 -> 0231 -> 0340 | N2 | Additional Name Information | O | 1
/// 0200 -> 0230 -> 0231 -> 0350 | N3 | Address Information | O | 2
/// 0200 -> 0230 -> 0231 -> 0360 | N4 | Geographic Location | O | 1
/// 0200 -> 0230 -> 0231 -> 0370 | L11 | Business Instructions and Reference Number | O | 10
/// 0200 -> 0230 -> LOOP ID - 0233 | 999999
/// 0200 -> 0230 -> 0233 -> 0380 | CD3 | Carton (Package) Detail | O | 1
/// 0200 -> 0230 -> 0233 -> 0390 | L11 | Business Instructions and Reference Number | O | 20
/// 0200 -> 0230 -> 0233 -> LOOP ID - 0240 | 10
/// 0200 -> 0230 -> 0233 -> 0240 -> 0400 | AT7 | Shipment Status Details | O | 1
/// 0200 -> 0230 -> 0233 -> 0240 -> 0402 | MS1 | Equipment, Shipment, or Real Property Location | O | 1
/// 0200 -> 0230 -> 0233 -> 0240 -> 0404 | MS2 | Equipment or Container Owner and Type | O | 1
/// 0200 -> 0230 -> 0233 -> 0405 | MAN | Marks and Numbers | O | 9999
/// 0200 -> LOOP ID - 0250 | 999999
/// 0200 -> 0250 -> 0410 | SPO | Shipment Purchase Order Detail | O | 1
/// 0200 -> 0250 -> 0420 | SDQ | Destination Quantity | O | 10
/// 0200 -> LOOP ID - 0260 | >1
/// 0200 -> 0260 -> 0423 | EFI | Electronic Format Identification | O | 1
/// 0200 -> 0260 -> 0426 | BIN | Binary Data | M | 1
/// 0610 | SE | Transaction Set Trailer | M | 1
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _214 {
pub st: ST,
pub b10: B10,
pub l11: Vec<L11>,
pub man: Vec<MAN>,
pub k1: Vec<K1>,
pub loop_0100: Vec<_214Loop0100>,
pub ms3: Vec<MS3>,
pub loop_0200: Vec<_214Loop0200>,
pub se: SE,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _214Loop0100 {
pub n1: Option<N1>,
pub n2: Option<N2>,
pub n3: Vec<N3>,
pub n4: Option<N4>,
pub g61: Option<G61>,
pub g62: Option<G62>,
pub l11: Vec<L11>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _214Loop0200 {
pub lx: Option<LX>,
pub loop_0205: Vec<_214Loop0200Loop0205>,
pub l11: Vec<L11>,
pub man: Vec<MAN>,
pub q7: Vec<Q7>,
pub k1: Vec<K1>,
pub at5: Vec<AT5>,
pub at8: Vec<AT8>,
pub loop_0210: Vec<_214Loop0200Loop0210>,
pub loop_0230: Vec<_214Loop0200Loop0230>,
pub loop_0250: Vec<_214Loop0200Loop0250>,
pub loop_0260: Vec<_214Loop0200Loop0260>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _214Loop0200Loop0205 {
pub at7: Option<AT7>,
pub ms1: Option<MS1>,
pub ms2: Option<MS2>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _214Loop0200Loop0210 {
pub cd3: Option<CD3>,
pub l11: Vec<L11>,
pub loop_0215: Vec<_214Loop0200Loop0210Loop0215>,
pub nm1: Option<NM1>,
pub q7: Vec<Q7>,
pub at8: Option<AT8>,
pub man: Vec<MAN>,
pub loop_0220: Vec<_214Loop0200Loop0210Loop0220>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _214Loop0200Loop0210Loop0215 {
pub at7: Option<AT7>,
pub ms1: Option<MS1>,
pub ms2: Option<MS2>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _214Loop0200Loop0210Loop0220 {
pub n1: Option<N1>,
pub n2: Option<N2>,
pub n3: Vec<N3>,
pub n4: Option<N4>,
pub l11: Vec<L11>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _214Loop0200Loop0230 {
pub prf: Option<PRF>,
pub loop_0231: Vec<_214Loop0200Loop0230Loop0231>,
pub loop_0233: Vec<_214Loop0200Loop0230Loop0233>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _214Loop0200Loop0230Loop0231 {
pub n1: Option<N1>,
pub n2: Option<N2>,
pub n3: Vec<N3>,
pub n4: Option<N4>,
pub l11: Vec<L11>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _214Loop0200Loop0230Loop0233 {
pub cd3: Option<CD3>,
pub l11: Vec<L11>,
pub loop_0240: Vec<_214Loop0200Loop0230Loop0233Loop0240>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _214Loop0200Loop0230Loop0233Loop0240 {
pub at7: Option<AT7>,
pub ms1: Option<MS1>,
pub ms2: Option<MS2>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _214Loop0200Loop0250 {
pub spo: Option<SPO>,
pub sdq: Option<SDQ>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _214Loop0200Loop0260 {
pub efi: Option<EFI>,
pub bin: BIN,
}
/// 301 Confirmation (Ocean)
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _301 {
pub st: ST,
pub b1: B1,
pub y3: Y3,
pub loop_y4: Vec<_301LoopY4>,
pub n9: Vec<N9>,
pub r2a: Vec<R2A>,
pub loop_n1: Vec<_301LoopN1>,
pub loop_r4: Vec<_301LoopR4>,
pub w09: Option<W09>,
pub h3: Option<H3>,
pub ea: Vec<EA>,
pub loop_lx: Vec<_301LoopLx>,
pub v1: Vec<V1>,
pub v9: Vec<V9>,
pub se: SE,
}
impl<'a> Parser<&'a str, _301, nom::error::Error<&'a str>> for _301 {
fn parse(input: &'a str) -> IResult<&'a str, _301> {
let mut output = _301::default();
let (rest, obj) = ST::parse(input)?;
output.st = obj;
let (rest, obj) = B1::parse(rest)?;
output.b1 = obj;
let (rest, obj) = Y3::parse(rest)?;
output.y3 = obj;
// loop y4
let mut loop_y4 = vec![];
let mut loop_rest = rest;
while peek(opt(Y4::parse))(loop_rest)?.1.is_some()
|| peek(opt(W09::parse))(loop_rest)?.1.is_some()
{
let (rest, y4) = opt(Y4::parse)(loop_rest)?;
let (rest, w09) = opt(W09::parse)(rest)?;
loop_rest = rest;
loop_y4.push(_301LoopY4 { y4, w09 });
}
let rest = loop_rest;
output.loop_y4 = loop_y4;
let (rest, obj) = many0(N9::parse)(rest)?;
output.n9 = obj;
let (rest, obj) = many0(R2A::parse)(rest)?;
output.r2a = obj;
// loop n1
let mut loop_n1 = vec![];
let mut loop_rest = rest;
while peek(opt(N1::parse))(loop_rest)?.1.is_some() {
println!("n1");
let (rest, n1) = opt(N1::parse)(loop_rest)?;
let (rest, n2) = opt(N2::parse)(rest)?;
let (rest, n3) = opt(N3::parse)(rest)?;
let (rest, n4) = opt(N4::parse)(rest)?;
let (rest, g61) = opt(G61::parse)(rest)?;
loop_rest = rest;
loop_n1.push(_301LoopN1 {
n1,
n2,
n3,
n4,
g61,
});
}
let rest = loop_rest;
output.loop_n1 = loop_n1;
// loop r4
let mut loop_r4 = vec![];
let mut loop_rest = rest;
while peek(opt(R4::parse))(loop_rest)?.1.is_some() {
let (rest, r4) = R4::parse(loop_rest)?;
let (rest, dtm) = many0(DTM::parse)(rest)?;
loop_rest = rest;
loop_r4.push(_301LoopR4 { r4, dtm });
}
let rest = loop_rest;
output.loop_r4 = loop_r4;
let (rest, obj) = opt(W09::parse)(rest)?;
output.w09 = obj;
let (rest, obj) = opt(H3::parse)(rest)?;
output.h3 = obj;
let (rest, obj) = many0(EA::parse)(rest)?;
output.ea = obj;
// loop lx
let mut loop_lx = vec![];
let mut loop_rest = rest;
while peek(opt(LX::parse))(loop_rest)?.1.is_some()
|| peek(opt(W09::parse))(loop_rest)?.1.is_some()
{
let (rest, lx) = LX::parse(loop_rest)?;
let (rest, n7) = opt(N7::parse)(rest)?;
let (rest, w09) = opt(W09::parse)(rest)?;
let (rest, k1) = many0(K1::parse)(rest)?;
let (rest, l0) = opt(L0::parse)(rest)?;
let (rest, l5) = opt(L5::parse)(rest)?;
let (rest, l4) = opt(L4::parse)(rest)?;
let (rest, l1) = opt(L1::parse)(rest)?;
loop_rest = rest;
// loop h1
let mut loop_h1 = vec![];
while peek(opt(H1::parse))(loop_rest)?.1.is_some() {
let (rest, h1) = opt(H1::parse)(loop_rest)?;
let (rest, h2) = many0(H2::parse)(rest)?;
loop_rest = rest;
loop_h1.push(_301LoopLxLoopH1 { h1, h2 });
}
loop_lx.push(_301LoopLx {
lx,
n7,
w09,
k1,
l0,
l5,
l4,
l1,
loop_h1,
});
}
let rest = loop_rest;
output.loop_lx = loop_lx;
let (rest, obj) = many0(V1::parse)(rest)?;
output.v1 = obj;
let (rest, obj) = many0(V9::parse)(rest)?;
output.v9 = obj;
let (rest, obj) = SE::parse(rest)?;
output.se = obj;
Ok((rest, output))
}
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _301LoopLx {
pub lx: LX,
pub n7: Option<N7>,
pub w09: Option<W09>,
pub k1: Vec<K1>,
pub l0: Option<L0>,
pub l5: Option<L5>,
pub l4: Option<L4>,
pub l1: Option<L1>,
pub loop_h1: Vec<_301LoopLxLoopH1>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _301LoopY4 {
pub y4: Option<Y4>,
pub w09: Option<W09>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _301LoopN1 {
pub n1: Option<N1>,
pub n2: Option<N2>,
pub n3: Option<N3>,
pub n4: Option<N4>,
pub g61: Option<G61>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _301LoopLxLoopH1 {
pub h1: Option<H1>,
pub h2: Vec<H2>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _301LoopR4 {
pub r4: R4,
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub dtm: Vec<DTM>,
}
/// 309 - U.S. Customs Manifest
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the U.S. Customs Manifest Transaction Set (309) for use within the context of an Electronic Data Interchange (EDI) environment. The transaction set can be used by carriers, terminal operators, port authorities, or service centers to provide U.S. Customs with manifest data on cargo arriving in or departing from the U.S. on oceangoing vessels, railroad trains, or other types of conveyances. The transaction set can be also used by carriers to provide terminal operators, port authorities, or service centers with manifest data on cargo arriving at their facilities via the conveyances mentioned above.
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 0010 | ST | Transaction Set Header | M | 1
/// 0020 | M10 | Manifest Identifying Information | M | 1
/// LOOP ID - P4 | 20
/// P4 -> 0040 | P4 | U.S. Port Information | M | 1
/// P4 -> LOOP ID - LX | 9999 |
/// P4 -> LX -> 0060 | LX | Assigned Number | M | 1
/// P4 -> LX -> 0070 | M13 | Manifest Amendment Details | O | 1
/// P4 -> LX -> 0080 | M11 | Manifest Bill of Lading Details | O | 1
/// P4 -> LX -> 0085 | N9 | Reference Identification | O | 999
/// P4 -> LX -> LOOP ID - N1 | 5 | |
/// P4 -> LX -> N1 -> 0100 | N1 | Name | O | 1
/// P4 -> LX -> N1 -> 0110 | N3 | Address Information | O | 2
/// P4 -> LX -> N1 -> 0120 | N4 | Geographic Location | O | 1
/// P4 -> LX -> N1 -> 0123 | DTM | Date/Time Reference | O | 1
/// P4 -> LX -> N1 -> 0125 | PER | Administrative Communications Contact | O | 1
/// P4 -> LX -> LOOP ID - M12 | 1 | |
/// P4 -> LX -> M12 -> 0130 | M12 | In-bond Identifying Information | O | 1
/// P4 -> LX -> M12 -> 0135 | P5 | Port Information | O | 5
/// P4 -> LX -> LOOP ID - VID | 999 | |
/// P4 -> LX -> VID -> 0150 | VID | Conveyance Identification | O | 1
/// P4 -> LX -> VID -> 0155 | VC | Motor Vehicle Control | O | 21
/// P4 -> LX -> VID -> LOOP ID - N10 | 999 | | |
/// P4 -> LX -> VID -> N10 -> 0160 | N10 | Quantity and Description | O | 1
/// P4 -> LX -> VID -> N10 -> LOOP ID - H1 | 10 | | | |
/// P4 -> LX -> VID -> N10 -> H1 -> 0165 | H1 | Hazardous Material | O | 1
/// P4 -> LX -> VID -> N10 -> H1 -> 0166 | H2 | Additional Hazardous Material Description | O | 99
/// 0200 | SE | Transaction Set Trailer | M | 1
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _309 {
pub st: ST,
pub m10: M10,
pub loop_p4: Vec<_309LoopP4>,
pub se: SE,
}
impl<'a> Parser<&'a str, _309, nom::error::Error<&'a str>> for _309 {
fn parse(input: &'a str) -> IResult<&'a str, _309> {
let mut output = _309::default();
let (rest, obj) = ST::parse(input)?;
output.st = obj;
let (rest, obj) = M10::parse(rest)?;
output.m10 = obj;
// loop p4
let mut loop_p4 = vec![];
let mut loop_rest = rest;
while peek(opt(P4::parse))(loop_rest)?.1.is_some() {
let (rest, p4) = P4::parse(loop_rest)?;
loop_rest = rest;
// loop lx
let mut loop_lx = vec![];
while peek(opt(LX::parse))(loop_rest)?.1.is_some() {
let (rest, lx) = LX::parse(loop_rest)?;
let (rest, m13) = opt(M13::parse)(rest)?;
let (rest, m11) = opt(M11::parse)(rest)?;
let (rest, n9) = many0(N9::parse)(rest)?;
loop_rest = rest;
// loop n1
let mut loop_n1 = vec![];
while peek(opt(N1::parse))(loop_rest)?.1.is_some() {
let (rest, n1) = opt(N1::parse)(loop_rest)?;
let (rest, n3) = opt(N3::parse)(rest)?;
let (rest, n4) = opt(N4::parse)(rest)?;
let (rest, dtm) = opt(DTM::parse)(rest)?;
let (rest, per) = opt(PER::parse)(rest)?;
loop_rest = rest;
loop_n1.push(_309LoopN1 {
n1,
n3,
n4,
dtm,
per,
});
}
// loop m12
let mut loop_m12 = vec![];
while peek(opt(M12::parse))(loop_rest)?.1.is_some() {
let (rest, m12) = opt(M12::parse)(loop_rest)?;
let (rest, r4) = many0(R4::parse)(rest)?;
loop_rest = rest;
loop_m12.push(_309LoopM12 { m12, r4 });
}
// loop vid
let mut loop_vid = vec![];
while peek(opt(VID::parse))(loop_rest)?.1.is_some() {
let (rest, vid) = opt(VID::parse)(loop_rest)?;
let (rest, m7) = many0(M7::parse)(rest)?;
loop_rest = rest;
// loop n10
let mut loop_n10 = vec![];
while peek(opt(N10::parse))(loop_rest)?.1.is_some() {
let (rest, n10) = opt(N10::parse)(loop_rest)?;
let (rest, vc) = many0(VC::parse)(rest)?;
loop_rest = rest;
// loop h1
let mut loop_h1 = vec![];
while peek(opt(H1::parse))(loop_rest)?.1.is_some() {
let (rest, h1) = opt(H1::parse)(loop_rest)?;
let (rest, h2) = many0(H2::parse)(rest)?;
loop_rest = rest;
loop_h1.push(_309LoopH1 { h1, h2 });
}
loop_n10.push(_309LoopN10 { n10, vc, loop_h1 });
}
loop_vid.push(_309LoopVID { vid, m7, loop_n10 });
}
loop_lx.push(_309LoopLX {
lx,
m13,
m11,
n9,
loop_n1,
loop_m12,
loop_vid,
});
}
loop_p4.push(_309LoopP4 { p4, loop_lx });
}
output.loop_p4 = loop_p4;
let rest = loop_rest;
let (rest, obj) = SE::parse(rest)?;
output.se = obj;
Ok((rest, output))
}
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _309LoopP4 {
pub p4: P4,
pub loop_lx: Vec<_309LoopLX>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _309LoopLX {
pub lx: LX,
pub m13: Option<M13>,
pub m11: Option<M11>,
pub n9: Vec<N9>,
pub loop_n1: Vec<_309LoopN1>,
pub loop_m12: Vec<_309LoopM12>,
pub loop_vid: Vec<_309LoopVID>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _309LoopN1 {
pub n1: Option<N1>,
pub n3: Option<N3>,
pub n4: Option<N4>,
pub dtm: Option<DTM>,
pub per: Option<PER>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _309LoopM12 {
pub m12: Option<M12>,
pub r4: Vec<R4>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _309LoopVID {
pub vid: Option<VID>,
pub m7: Vec<M7>,
pub loop_n10: Vec<_309LoopN10>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _309LoopN10 {
pub n10: Option<N10>,
pub vc: Vec<VC>,
pub loop_h1: Vec<_309LoopH1>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _309LoopH1 {
pub h1: Option<H1>,
pub h2: Vec<H2>,
}
/// 310 - Freight Receipt and Invoice (Ocean)
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the Freight Receipt and Invoice (Ocean) Transaction Set (310) for use within the context of an Electronic Data Interchange (EDI) environment. The transaction set can be used to provide ocean bill of lading information. It is sent by ocean carriers to interested parties and can be used as the receipt for the shipment; to substitute for a paper bill of lading where the parties have agreed that a paper bill of lading is not necessary; to allow shipper or forwarder to verify bill of lading information before an original is printed and released; for information purposes, i.e., as a bill of lading copy; by the carrier to convey manifest information to a terminal operator; and as an invoice for freight.
///
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 010 | ST | Transaction Set Header | M | 1
/// 020 | B3 | Beginning Segment for Carrier's Invoice | M | 1
/// 030 | B2A | Set Purpose | O | 1
/// 040 | Y6 | Authentication | O | 2
/// 050 | G3 | Compensation Information | O | 1
/// 060 | N9 | Reference Identification | O | 15
/// 070 | V1 | Vessel Identification | M | 2
/// 080 | M0 | Letter of Credit Reference | O | 1
/// 090 | M1 | Insurance | O | 5
/// 100 | C2 | Bank ID | O | 1
/// 110 | C3 | Currency | O | 1
/// 120 | Y2 | Container Details | O | 10
/// LOOP ID - N1 | 10
/// N1 -> 130 | N1 | Name | M | 1
/// N1 -> 140 | N2 | Additional Name Information | O | 1
/// N1 -> 150 | N3 | Address Information | O | 2
/// N1 -> 160 | N4 | Geographic Location | O | 1
/// 170 | G61 | Contact | O | 3
/// LOOP ID - R4 | 20
/// R4 -> 180 | R4 | Port or Terminal | M | 1
/// R4 -> 190 | DTM | Date/Time Reference | O | 15
/// 199 | R2A | Route Information with Preference | O | 25
/// 200 | R2 | Route Information | O | 13
/// 210 | K1 | Remarks | O | 12
/// 220 | H3 | Special Handling Instructions | O | 6
/// 230 | L5 | Description, Marks and Numbers | O | 1 |
/// LOOP ID - C8 | 20
/// C8 -> 240 | C8 | Certifications and Clauses | O | 1
/// C8 -> 250 | C8C| Certifications Clauses Continuation | O | 5
/// LOOP ID - LX | 999
/// LX -> 010 | LX | Assigned Number | M | 1 |
/// LX -> LOOP ID - N7 | 999
/// LX -> N7 -> 020 | N7 | Equipment Details | O | 1 |
/// LX -> N7 -> 025 | QTY | Quantity | O | 1 |
/// LX -> N7 -> 030 | V4 | Cargo Location Reference | O | 1 |
/// LX -> N7 -> 040 | N12 | Equipment Environment | O | 1 |
/// LX -> N7 -> 050 | M7 | Seal Numbers | O | 5 |
/// LX -> N7 -> 060 | W09 | Equipment and Temperature | O | 1 |
/// LX -> N7 -> LOOP ID - L1 | 20
/// LX -> N7 -> L1 -> 070 | L1 | Rate and Charges | O | 1 |
/// LX -> N7 -> L1 -> 080 | C3 | Currency | O | 1 |
/// LX -> N7 -> 090 | L7 | Tariff Reference | O | 1 |
/// LX -> N7 -> 100 | X1 | Export License | O | 1 |
/// LX -> N7 -> 110 | X2 | Import License | O | 1 |
/// LX -> N7 -> 120 | N9 | Reference Identification | O | 3 |
/// LX -> N7 -> LOOP ID - H1 | 10
/// LX -> N7 -> H1 -> 130 | H1 | Hazardous Material | O | 1 |
/// LX -> N7 -> H1 -> 140 | H2 | Additional Hazardous Material Description | O | 10 |
/// LX -> LOOP ID - L0 | 120
/// LX -> L0 -> 150 | L0 | Line Item - Quantity and Weight | O | 1 |
/// LX -> L0 -> 160 | L5 | Description, Marks and Numbers | O | 999 |
/// LX -> L0 -> | | LOOP ID - L1 | 20
/// LX -> L0 -> L1 -> 170 | L1 | Rate and Charges | O | 1 |
/// LX -> L0 -> L1 -> 180 | C3 | Currency | O | 1 |
/// LX -> L0 -> 190 | L7 | Tariff Reference | O | 1 |
/// LX -> L0 -> 200 | X1 | Export License | O | 1 |
/// LX -> L0 -> 210 | X2 | Import License | O | 1 |
/// LX -> L0 -> LOOP ID - C8 | 20
/// LX -> L0 -> C8 -> 220 | C8 | Certifications and Clauses | O | 1 |
/// LX -> L0 -> C8C -> 221 | C8C | Certifications Clauses Continuation | O | 5 |
/// LX -> L0 -> LOOP ID - H1 | 10
/// LX -> L0 -> H1 -> 230 | H1 | Hazardous Material | O | 1 |
/// LX -> L0 -> H1 -> 240 | H2 | Additional Hazardous Material Description | O | 10
/// 010 | L3 | Total Weight and Charges | M | 1
/// 020 | PWK | Paperwork | O | 25
/// LOOP ID - L1 | 20
/// L1 -> 030 | L1 | Rate and Charges | O | 1
/// L1 -> 040 | C3 | Currency | O | 1
/// 050 | V9 | Event Detail | O | 10
/// 055 | C8 | Certifications and Clauses | O | 20
/// 060 | K1 | Remarks | O | 999
/// 070 | L11 | Business Instructions and Reference Number | O | 1
/// 080 | SE | Transaction Set Trailer | M | 1 |
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, DisplayX12)]
pub struct _310 {
pub st: ST,
pub b3: B3,
pub b2a: Option<B2A>,
#[serde(default)]
pub y6: Vec<Y6>,
pub g3: Option<G3>,
#[serde(default)]
pub n9: Vec<N9>,
#[serde(default)]
pub v1: Vec<V1>,
pub m0: Option<M0>,
#[serde(default)]
pub m1: Vec<M1>,
pub c2: Option<C2>,
pub c3: Option<C3>,
#[serde(default)]
pub y2: Vec<Y2>,
#[serde(default)]
pub loop_n1: Vec<_310LoopN1>,
#[serde(default)]
pub g61: Vec<G61>,
#[serde(default)]
pub loop_r4: Vec<_310LoopR4>,
#[serde(default)]
pub r2a: Vec<R2A>,
#[serde(default)]
pub r2: Vec<R2>,
/// heading remarks
#[serde(default)]
pub k1: Vec<K1>,
#[serde(default)]
pub h3: Vec<H3>,
pub l5: Option<L5>,
#[serde(default)]
pub loop_c8: Vec<_310LoopC8>,
#[serde(default)]
pub loop_lx: Vec<_310LoopLX>,
pub l3: L3,
#[serde(default)]
pub pwk: Vec<PWK>,
#[serde(default)]
pub loop_l1: Vec<_310LoopL1>,
pub v9: Vec<V9>,
pub c8: Vec<C8>,
///TODO summary remarks
pub k1_2: Vec<K1>,
pub l11: Option<L11>,
pub se: SE,
}
impl<'a> Parser<&'a str, _310, nom::error::Error<&'a str>> for _310 {
fn parse(input: &'a str) -> IResult<&'a str, _310> {
let (rest, st) = ST::parse(input)?;
let (rest, b3) = B3::parse(rest)?;
let (rest, b2a) = opt(B2A::parse)(rest)?;
let (rest, y6) = many0(Y6::parse)(rest)?;
let (rest, g3) = opt(G3::parse)(rest)?;
let (rest, n9) = many0(N9::parse)(rest)?;
let (rest, v1) = many0(V1::parse)(rest)?;
let (rest, m0) = opt(M0::parse)(rest)?;
let (rest, m1) = many0(M1::parse)(rest)?;
let (rest, c2) = opt(C2::parse)(rest)?;
let (rest, c3) = opt(C3::parse)(rest)?;
let (rest, y2) = many0(Y2::parse)(rest)?;
// n1 loop
let mut loop_n1 = vec![];
let mut loop_rest = rest;
while peek(opt(N1::parse))(loop_rest)?.1.is_some() {
let (rest, n1) = N1::parse(loop_rest)?;
let (rest, n2) = opt(N2::parse)(rest)?;
let (rest, n3) = opt(N3::parse)(rest)?;
let (rest, n4) = opt(N4::parse)(rest)?;
loop_rest = rest;
loop_n1.push(_310LoopN1 { n1, n2, n3, n4 });
}
let rest = loop_rest;
let (rest, g61) = many0(G61::parse)(rest)?;
// loop r4
let mut loop_r4 = vec![];
let mut loop_rest = rest;
while peek(opt(R4::parse))(loop_rest)?.1.is_some() {
let (rest, r4) = R4::parse(loop_rest)?;
let (rest, dtm) = opt(DTM::parse)(rest)?;
loop_rest = rest;
loop_r4.push(_310LoopR4 { r4, dtm });
}
let rest = loop_rest;
let (rest, r2a) = many0(R2A::parse)(rest)?;
let (rest, r2) = many0(R2::parse)(rest)?;
let (rest, k1) = many0(K1::parse)(rest)?;
let (rest, h3) = many0(H3::parse)(rest)?;
let (rest, l5) = opt(L5::parse)(rest)?;
// loop c8
let mut loop_c8 = vec![];
let mut loop_rest = rest;
while peek(opt(C8::parse))(loop_rest)?.1.is_some() {
let (rest, c8) = opt(C8::parse)(loop_rest)?;
let (rest, c8c) = many0(C8C::parse)(rest)?;
loop_rest = rest;
loop_c8.push(_310LoopC8 { c8, c8c });
}
let rest = loop_rest;
// loop lx
let mut loop_lx = vec![];
let mut loop_rest = rest;
while peek(opt(LX::parse))(loop_rest)?.1.is_some() {
let (rest, lx) = LX::parse(loop_rest)?;
loop_rest = rest;
// loop n7
let mut loop_n7 = vec![];
while peek(opt(N7::parse))(loop_rest)?.1.is_some()
|| peek(opt(L1::parse))(loop_rest)?.1.is_some()
{
let (rest, n7) = opt(N7::parse)(loop_rest)?;
let (rest, qty) = opt(QTY::parse)(rest)?;
let (rest, v4) = opt(V4::parse)(rest)?;
let (rest, n12) = opt(N12::parse)(rest)?;
let (rest, m7) = many0(M7::parse)(rest)?;
let (rest, w09) = opt(W09::parse)(rest)?;
// loop l1
let mut loop_l1 = vec![];
loop_rest = rest;
while peek(opt(L1::parse))(loop_rest)?.1.is_some() {
let (rest, l1) = opt(L1::parse)(loop_rest)?;
let (rest, c3) = opt(C3::parse)(rest)?;
loop_rest = rest;
loop_l1.push(_310LoopL1 { l1, c3 });
}
let (rest, l7) = opt(L7::parse)(loop_rest)?;
let (rest, x1) = opt(X1::parse)(rest)?;
let (rest, x2) = opt(X2::parse)(rest)?;
let (rest, n9) = many0(N9::parse)(rest)?;
loop_rest = rest;
loop_n7.push(_310LoopN7 {
n7,
qty,
v4,
n12,
m7,
w09,
loop_l1,
l7,
x1,
x2,
n9,
loop_h1: vec![],
});
}
// loop l0
let mut loop_l0 = vec![];
while peek(opt(L0::parse))(loop_rest)?.1.is_some() {
let (rest, l0) = opt(L0::parse)(loop_rest)?;
let (rest, l5) = many0(L5::parse)(rest)?;
loop_rest = rest;
// loop l1
let mut loop_l1 = vec![];
while peek(opt(L1::parse))(loop_rest)?.1.is_some() {
let (rest, l1) = opt(L1::parse)(loop_rest)?;
let (rest, c3) = opt(C3::parse)(rest)?;
loop_rest = rest;
loop_l1.push(_310LoopL1 { l1, c3 });
}
// loop c8
let mut loop_c8 = vec![];
while peek(opt(C8::parse))(loop_rest)?.1.is_some() {
let (rest, c8) = opt(C8::parse)(loop_rest)?;
let (rest, c8c) = many0(C8C::parse)(rest)?;
loop_rest = rest;
loop_c8.push(_310LoopC8 { c8, c8c });
}
// loop h1
let mut loop_h1 = vec![];
while peek(opt(H1::parse))(loop_rest)?.1.is_some() {
let (rest, h1) = opt(H1::parse)(loop_rest)?;
let (rest, h2) = many0(H2::parse)(rest)?;
loop_rest = rest;
loop_h1.push(_310LoopH1 { h1, h2 });
}
loop_l0.push(_310LoopL0 {
l0,
l5,
loop_l1: vec![],
l7: None,
x1: None,
x2: None,
loop_c8,
loop_h1,
});
}
loop_lx.push(_310LoopLX {
lx,
loop_n7,
loop_l0,
});
}
let rest = loop_rest;
let (rest, l3) = L3::parse(rest)?;
let (rest, pwk) = many0(PWK::parse)(rest)?;
// loop l1
let mut loop_l1 = vec![];
let mut loop_rest = rest;
while peek(opt(L1::parse))(loop_rest)?.1.is_some() {
let (rest, l1) = opt(L1::parse)(loop_rest)?;
let (rest, c3) = opt(C3::parse)(rest)?;
loop_rest = rest;
loop_l1.push(_310LoopL1 { l1, c3 });
}
let rest = loop_rest;
let (rest, v9) = many0(V9::parse)(rest)?;
let (rest, c8) = many0(C8::parse)(rest)?;
let (rest, k1_2) = many0(K1::parse)(rest)?;
let (rest, l11) = opt(L11::parse)(rest)?;
let (rest, se) = SE::parse(rest)?;
let output = _310 {
st,
b3,
b2a,
y6,
g3,
n9,
v1,
m0,
m1,
c2,
c3,
y2,
loop_n1,
g61,
loop_r4,
r2a,
r2,
k1,
h3,
l5,
loop_c8,
loop_lx,
l3,
pwk,
loop_l1: vec![],
v9,
c8,
k1_2,
l11,
se,
};
Ok((rest, output))
}
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, DisplayX12)]
pub struct _310LoopN1 {
pub n1: N1,
pub n2: Option<N2>,
pub n3: Option<N3>,
pub n4: Option<N4>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, DisplayX12)]
pub struct _310LoopR4 {
pub r4: R4,
#[serde(skip_serializing_if = "Option::is_none")]
pub dtm: Option<DTM>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, DisplayX12)]
pub struct _310LoopC8 {
#[serde(skip_serializing_if = "Option::is_none")]
pub c8: Option<C8>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub c8c: Vec<C8C>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, DisplayX12)]
pub struct _310LoopLX {
pub lx: LX,
pub loop_n7: Vec<_310LoopN7>,
pub loop_l0: Vec<_310LoopL0>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, DisplayX12)]
pub struct _310LoopN7 {
pub n7: Option<N7>,
pub qty: Option<QTY>,
pub v4: Option<V4>,
pub n12: Option<N12>,
pub m7: Vec<M7>,
pub w09: Option<W09>,
pub loop_l1: Vec<_310LoopL1>,
pub l7: Option<L7>,
pub x1: Option<X1>,
pub x2: Option<X2>,
pub n9: Vec<N9>,
pub loop_h1: Vec<_310LoopH1>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, DisplayX12)]
pub struct _310LoopL0 {
pub l0: Option<L0>,
pub l5: Vec<L5>,
pub loop_l1: Vec<_310LoopL1>,
pub l7: Option<L7>,
pub x1: Option<X1>,
pub x2: Option<X2>,
pub loop_c8: Vec<_310LoopC8>,
pub loop_h1: Vec<_310LoopH1>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, DisplayX12)]
pub struct _310LoopL1 {
pub l1: Option<L1>,
pub c3: Option<C3>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, DisplayX12)]
pub struct _310LoopH1 {
pub h1: Option<H1>,
pub h2: Vec<H2>,
}
/// 315 - Status Details (Ocean)
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the Status Details (Ocean) Transaction Set (315) for use within the context of an Electronic Data Interchange (EDI) environment. The transaction set can be used to provide all the information necessary to report status or event details for selected shipments or containers. It is intended to accommodate the details for one status or event associated with many shipments or containers, as well as more than one status or event for one shipment or container.
///
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 0010 | ST | Transaction Set Header | M | 1
/// 0020 | B4 | Beginning Segment for Inquiry or Reply | M | 1
/// 0030 | N9 | Reference Identification | O | 30
/// 0040 | Q2 | Status Details (Ocean) | O | 1
/// 0050 | SG | Shipment Status | O | 15
/// LOOP ID - R4 | 20
/// R4 -> 0060 | R4 | Port or Terminal | M | 1
/// R4 -> 0070 | DTM | Date/Time Reference | O | 15
/// 0080 | V9 | Event Detail | O | 10
/// 0090 | SE | Transaction Set Trailer | M | 1
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, DisplayX12)]
pub struct _315 {
pub st: ST,
pub b4: B4,
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub n9: Vec<N9>,
#[serde(skip_serializing_if = "Option::is_none")]
pub q2: Option<Q2>,
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub sg: Vec<SG>,
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub loop_r4: Vec<_315LoopR4>,
#[serde(skip_serializing_if = "Option::is_none")]
pub v9: Option<V9>,
pub se: SE,
}
impl<'a> Parser<&'a str, _315, nom::error::Error<&'a str>> for _315 {
fn parse(input: &'a str) -> IResult<&'a str, _315> {
let mut output = _315::default();
let (rest, obj) = ST::parse(input)?;
output.st = obj;
let (rest, obj) = B4::parse(rest)?;
output.b4 = obj;
let (rest, obj) = many0(N9::parse)(rest)?;
output.n9 = obj;
let (rest, obj) = opt(Q2::parse)(rest)?;
output.q2 = obj;
let (rest, obj) = many0(SG::parse)(rest)?;
output.sg = obj;
// loop r4
let mut loop_r4 = vec![];
let mut loop_rest = rest;
while peek(opt(R4::parse))(loop_rest)?.1.is_some() {
let (rest, r4) = R4::parse(loop_rest)?;
let (rest, dtm) = many0(DTM::parse)(rest)?;
loop_rest = rest;
loop_r4.push(_315LoopR4 { r4, dtm });
}
let rest = loop_rest;
output.loop_r4 = loop_r4;
let (rest, obj) = opt(V9::parse)(rest)?;
output.v9 = obj;
let (rest, obj) = SE::parse(rest)?;
output.se = obj;
Ok((rest, output))
}
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, DisplayX12)]
pub struct _315LoopR4 {
pub r4: R4,
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub dtm: Vec<DTM>,
}
/// 322 - Terminal Operations and Intermodal Ramp Activity
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the Terminal Operations and Intermodal Ramp Activity Transaction Set (322) for use within the context of an Electronic Data Interchange (EDI) environment. The transaction set can be used to provide all the information necessary for a terminal operation, port authority or intermodal ramp to communicate terminal and intermodal ramp activities (e.g., "ingates" and "outgates") to authorized parties to a shipment.
///
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 0010 | ST | Transaction Set Header | M | 1 | |
/// 0015 | ZC1 | Beginning Segment For Data Correction Or Change | O | 1 | |
/// 0016 | Q5 | Status Details | M | 1 | |
/// LOOP ID - N7 | 1000
/// N7 -> 0020 | N7 | Equipment Details | M | 1 | |
/// N7 -> 0030 | V4 | Cargo Location Reference | O | 1 | |
/// N7 -> 0040 | DTM | Date/Time Reference | O | 2 | |
/// N7 -> 0050 | M7 | Seal Numbers | O | 5 | |
/// N7 -> 0060 | W09 | Equipment and Temperature | O | 1 | |
/// N7 -> 0070 | W2 | Equipment Identification | O | 1 | |
/// N7 -> 0080 | NA | Cross-Reference Equipment | O | 30 | |
/// N7 -> 0085 | GR5 | Loading Details | O | 10 | |
/// N7 -> 0100 | Y7 | Priority | O | 1 | |
/// N7 -> 0110 | V1 | Vessel Identification | O | 1 | |
/// N7 -> LOOP ID - R4 | 20 |
/// N7 -> R4 -> 0120 | R4 | Port or Terminal | M | 1 | |
/// N7 -> R4 -> 0130 | DTM | Date/Time Reference | O | 15 | |
/// N7 -> 0140 | H3 | Special Handling Instructions | O | 6 | |
/// N7 -> LOOP ID - N1 | 10 |
/// N7 -> N1 -> 0150 | N1 | Name | O | 1 | |
/// N7 -> N1 -> 0153 | N3 | Address Information | O | 2 | |
/// N7 -> N1 -> 0156 | N4 | Geographic Location | O | 1 | |
/// N7 -> 0160 | K1 | Remarks | O | 2 | |
/// N7 -> 0170 | N9 | Reference Identification | O | 10 | |
/// N7 -> LOOP ID - L0 | 999 |
/// N7 -> L0 -> 0180 | L0 | Line Item - Quantity and Weight | O | 1 | |
/// N7 -> L0 -> 0190 | L5 | Description, Marks and Numbers | O | 1 | |
/// N7 -> L0 -> 0200 | H1 | Hazardous Material | O | 3 | |
/// N7 -> 0210 | L3 | Total Weight and Charges | O | 2 | |
/// 0220 | SE | Transaction Set Trailer | M | 1 | |
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _322 {
pub st: ST,
pub zc1: Option<ZC1>,
pub q5: Q5,
pub loop_n7: Vec<_322LoopN7>,
pub se: SE,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _322LoopN7 {
pub n7: N7,
pub v4: Option<V4>,
pub dtm: Option<DTM>,
pub m7: Option<M7>,
pub w09: Option<W09>,
pub w2: Option<W2>,
pub na: Option<NA>,
pub gr5: Option<GR5>,
pub y7: Option<Y7>,
pub v1: Option<V1>,
pub loop_r4: Vec<_322LoopR4>,
pub h3: Vec<H3>,
pub loop_n1: Vec<_322LoopN1>,
pub k1: Vec<K1>,
pub n9: Vec<N9>,
pub loop_l0: Vec<_322LoopL0>,
pub l3: Vec<L3>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _322LoopR4 {
r4: R4,
#[serde(default)]
dtm: Vec<DTM>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _322LoopN1 {
n1: Option<N1>,
n3: Vec<N3>,
n4: Option<N4>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _322LoopL0 {
l0: Option<L0>,
l5: Option<L5>,
h1: Vec<H1>,
}
/// 404 - Rail Carrier Shipment Information
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the Rail Carrier Shipment Information Transaction Set (404) for use within the context of an Electronic Data Interchange (EDI) environment. The transaction set can be used to transmit rail-carrier-specific bill of lading information to a railroad. It is the initial tender of a shipment between a consignor and a rail carrier and can be used as notification of equipment release and/or a legal bill of lading.
///
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 0010 | ST | Transaction Set Header | M | 1 | | |
/// 0020 | ZC1 | Beginning Segment For Data Correction Or Change | O | 1 | | |
/// 0030 | BX | General Shipment Information | O | 1 | | |
/// 0040 | BNX | Rail Shipment Information | O | 1 | | |
/// 0050 | M3 | Release | M | 1 | | |
/// 0060 | N9 | Reference Identification | M | 30 | | |
/// 0070 | CM | Cargo Manifest | O | 2 | | |
/// 0080 | M1 | Insurance | O | 1 | | |
/// 0090 | DTM | Date/Time Reference | O | 5 | | |
/// LOOP ID - N7 | 500
/// N7 -> 0100 | N7 | Equipment Details | M | 1 | | |
/// N7 -> 0101 | EM | Equipment Characteristics | O | 1 | | |
/// N7 -> LOOP ID - VC | 21 |
/// N7 -> VC -> 0110 | VC | Motor Vehicle Control | O | 1 | | |
/// N7 -> VC -> LOOP ID - N1 | 2 | |
/// N7 -> VC -> N1 -> 0112 | N1 | Name | O | 1 | | |
/// N7 -> VC -> N1 -> 0114 | N3 | Address Information | O | 2 | | |
/// N7 -> VC -> N1 -> 0116 | N4 | Geographic Location | O | 1 | | |
/// N7 -> VC -> N1 -> 0118 | H3 | Special Handling Instructions | O | 1 | | |
/// N7 -> 0130 | M7 | Seal Numbers | O | 5 | | |
/// N7 -> 0140 | N5 | Equipment Ordered | O | 1 | | |
/// N7 -> 0150 | IC | Intermodal Chassis Equipment | O | 1 | | |
/// N7 -> 0160 | IM | Intermodal Movement Information | O | 1 | | |
/// N7 -> 0170 | M12 | In-bond Identifying Information | O | 2 | | |
/// N7 -> LOOP ID - E1 | 2 |
/// N7 -> E1 -> 0171 | E1 | Empty Car Disposition - Pended Destination Consignee | O | 1 | | |
/// N7 -> E1 -> 0172 | E4 | Empty Car Disposition - Pended Destination City | O | 1 | | |
/// N7 -> E1 -> 0173 | E5 | Empty Car Disposition - Pended Destination Route | O | 13 | | |
/// N7 -> E1 -> 0174 | PI | Price Authority Identification | O | 1 | | |
/// N7 -> 0175 | GA | Canadian Grain Information | O | 15 | | |
/// N7 -> LOOP ID - REF | 99 |
/// N7 -> REF -> 0177 | REF | Reference Identification | O | 1 | | |
/// N7 -> REF -> 0178 | N10 | Quantity and Description | O | 15 | | |
/// N7 -> REF -> LOOP ID - N1 | 5 | |
/// N7 -> REF -> N1 -> 0179 | N1 | Name | O | 1 | | |
/// N7 -> REF -> N1 -> 0180 | N3 | Address Information | O | 1 | | |
/// N7 -> REF -> N1 -> 0182 | N4 | Geographic Location | O | 1 | | |
/// 0185 | NA | Cross-Reference Equipment | O | 10 | | |
/// 0190 | F9 | Origin Station | M | 1 | | |
/// 0200 | D9 | Destination Station | M | 1 | | |
/// LOOP ID - N1 | 10
/// N1 -> 0210 | N1 | Name | M | 1 | | |
/// N1 -> 0215 | N2 | Additional Name Information | O | 2 | | |
/// N1 -> 0220 | N3 | Address Information | O | 2 | | |
/// N1 -> 0230 | N4 | Geographic Location | O | 1 | | |
/// N1 -> 0235 | REF | Reference Identification | O | 2 | | |
/// N1 -> 0240 | PER | Administrative Communications Contact | O | 2 | | |
/// N1 -> 0252 | BL | Billing Information | O | 12 | | |
/// LOOP ID - S1 | 12
/// S1 -> 0430 | S1 | Stop-off Name | O | 1 | | |
/// S1 -> 0440 | S2 | Stop-off Address | O | 2 | | |
/// S1 -> 0448 | S9 | Stop-off Station | O | 1 | | |
/// S1 -> 0449 | N1 | Name | O | 1 | | |
/// S1 -> 0450 | N2 | Additional Name Information | O | 1 | | |
/// S1 -> 0451 | N3 | Address Information | O | 1 | | |
/// S1 -> 0452 | N4 | Geographic Location | O | 1 | | |
/// S1 -> 0453 | PER | Administrative Communications Contact | O | 1 | | |
/// 0460 | R2 | Route Information | O | 13 | | |
/// 0480 | R9 | Route Code | O | 1 | | |
/// LOOP ID - E1 | 2
/// E1 -> 0490 | E1 | Empty Car Disposition - Pended Destination Consignee | O | 1 | | |
/// E1 -> 0500 | E4 | Empty Car Disposition - Pended Destination City | O | 1 | | |
/// E1 -> 0510 | E5 | Empty Car Disposition - Pended Destination Route | O | 13 | | |
/// E1 -> 0511 | PI | Price Authority Identification | O | 1 | | |
/// 0520 | H3 | Special Handling Instructions | O | 20 | | |
/// 0530 | PS | Protective Service Instructions | O | 5 | | |
/// LOOP ID - LX | 25
/// LX -> 0540 | LX | Assigned Number | M | 1 | | |
/// LX -> 0550 | L5 | Description, Marks and Numbers | M | 15 | | |
/// LX -> LOOP ID - L0 | 25 |
/// LX -> L0 -> 0570 | L0 | Line Item - Quantity and Weight | O | 1 | | |
/// LX -> L0 -> 0575 | MEA | Measurements | O | 3 | | |
/// LX -> L0 -> 0580 | L1 | Rate and Charges | O | 10 | | |
/// LX -> L0 -> 0590 | PI | Price Authority Identification | O | 30 | | |
/// LX -> 0600 | X1 | Export License | O | 6 | | |
/// LOOP ID - T1 | 64
/// T1 -> 0610 | T1 | Transit Inbound Origin | O | 1 | | |
/// T1 -> 0620 | T2 | Transit Inbound Lading | O | 30 | | |
/// T1 -> 0630 | T3 | Transit Inbound Route | O | 12 | | |
/// T1 -> 0640 | T6 | Transit Inbound Rates | O | 1 | | |
/// T1 -> 0650 | T8 | Free-form Transit Data | O | 99 | | |
/// 0660 | L3 | Total Weight and Charges | O | 1 | | |
/// 0670 | LS | Loop Header | O | 1 | | |
/// LOOP ID - LH1 | 100
/// LH1 -> 0680 | LH1 | Hazardous Identification Information | O | 1 | | |
/// LH1 -> 0690 | LH2 | Hazardous Classification Information | O | 4 | | |
/// LH1 -> 0700 | LH3 | Hazardous Material Shipping Name | O | 10 | | |
/// LH1 -> 0710 | LFH | Freeform Hazardous Material Information | O | 20 | | |
/// LH1 -> 0720 | LEP | EPA Required Data | O | 3 | | |
/// LH1 -> 0730 | LH4 | Canadian Dangerous Requirements | O | 1 | | |
/// LH1 -> 0740 | LHT | Transborder Hazardous Requirements | O | 3 | | |
/// LH1 -> 0750 | LHR | Hazardous Material Identifying Reference Numbers | O | 5 | | |
/// LH1 -> 0755 | PER | Administrative Communications Contact | O | 5 | | |
/// 0760 | LE | Loop Trailer | O | 1 | | |
/// 0770 | PER | Administrative Communications Contact | O | 5 | | |
/// 0780 | LH2 | Hazardous Classification Information | O | 6 | | |
/// 0790 | LHR | Hazardous Material Identifying Reference Numbers | O | 1 | | |
/// 0800 | LH6 | Hazardous Certification | O | 5 | | |
/// 0810 | XH | Pro Forma - B13 Information | O | 1 | | |
/// 0820 | X7 | Customs Information | O | 10 | | |
/// 0840 | SE | Transaction Set Trailer | M | 1
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404 {
pub st: ST,
pub zc1: Option<ZC1>,
pub bx: Option<BX>,
pub bnx: Option<BNX>,
pub m3: M3,
pub n9: Vec<N9>,
pub cm: Vec<CM>,
pub m1: Option<M1>,
pub dtm: Option<DTM>,
pub loop_n7: Vec<_404LoopN7>,
pub na: Option<NA>,
pub f9: F9,
pub d9: D9,
pub loop_n1: Vec<_404LoopN1>,
pub loop_s1: Vec<_404LoopS1>,
pub r2: Vec<R2>,
pub r9: Option<R9>,
pub loop_e1: Vec<_404LoopE1>,
pub h3: Vec<H3>,
pub ps: Vec<PS>,
pub loop_lx: Vec<_404LoopLX>,
pub loop_t1: Vec<_404LoopT1>,
pub l3: Option<L3>,
pub ls: Option<LS>,
pub loop_lh1: Vec<_404LoopLH1>,
pub le: Option<LE>,
pub per: Option<PER>,
pub lh2: Option<LH2>,
pub lhr: Option<LHR>,
pub lh6: Option<LH6>,
pub xh: Option<XH>,
pub x7: Option<X7>,
pub se: SE,
}
impl<'a> Parser<&'a str, _404, nom::error::Error<&'a str>> for _404 {
fn parse(input: &'a str) -> IResult<&'a str, _404> {
let mut output = _404::default();
let (rest, obj) = ST::parse(input)?;
output.st = obj;
let (rest, obj) = opt(ZC1::parse)(rest)?;
output.zc1 = obj;
let (rest, obj) = opt(BX::parse)(rest)?;
output.bx = obj;
let (rest, obj) = opt(BNX::parse)(rest)?;
output.bnx = obj;
let (rest, obj) = M3::parse(rest)?;
output.m3 = obj;
let (rest, obj) = many0(N9::parse)(rest)?;
output.n9 = obj;
let (rest, obj) = many0(CM::parse)(rest)?;
output.cm = obj;
let (rest, obj) = opt(M1::parse)(rest)?;
output.m1 = obj;
let (rest, obj) = opt(DTM::parse)(rest)?;
output.dtm = obj;
// loop n7
let mut loop_n7 = vec![];
let mut loop_rest = rest;
while peek(opt(N7::parse))(loop_rest)?.1.is_some() {
let (rest, n7) = N7::parse(loop_rest)?;
let (rest, em) = opt(EM::parse)(rest)?;
let (rest, m7) = opt(M7::parse)(rest)?;
let (rest, n5) = opt(N5::parse)(rest)?;
let (rest, ic) = opt(IC::parse)(rest)?;
let (rest, im) = opt(IM::parse)(rest)?;
let (rest, m12) = opt(M12::parse)(rest)?;
let (rest, ga) = opt(GA::parse)(rest)?;
loop_rest = rest;
loop_n7.push(_404LoopN7 {
n7,
em,
loop_vc: vec![],
m7,
n5,
ic,
im,
m12,
loop_e1: vec![],
ga,
loop_ref: vec![],
});
}
let rest = loop_rest;
output.loop_n7 = loop_n7;
let (rest, obj) = opt(NA::parse)(rest)?;
output.na = obj;
let (rest, obj) = F9::parse(rest)?;
output.f9 = obj;
let (rest, obj) = D9::parse(rest)?;
output.d9 = obj;
// loop n1
let mut loop_n1 = vec![];
let mut loop_rest = rest;
while peek(opt(N1::parse))(loop_rest)?.1.is_some() {
let (rest, n1) = N1::parse(loop_rest)?;
let (rest, n2) = opt(N2::parse)(rest)?;
let (rest, n3) = opt(N3::parse)(rest)?;
let (rest, n4) = opt(N4::parse)(rest)?;
let (rest, r#ref) = opt(REF::parse)(rest)?;
let (rest, per) = opt(PER::parse)(rest)?;
let (rest, bl) = opt(BL::parse)(rest)?;
loop_rest = rest;
loop_n1.push(_404LoopN1 {
n1,
n2,
n3,
n4,
r#ref,
per,
bl,
});
}
let rest = loop_rest;
output.loop_n1 = loop_n1;
let (rest, obj) = many0(R2::parse)(rest)?;
output.r2 = obj;
let (rest, obj) = opt(R9::parse)(rest)?;
output.r9 = obj;
let (rest, obj) = many0(H3::parse)(rest)?;
output.h3 = obj;
let (rest, obj) = many0(PS::parse)(rest)?;
output.ps = obj;
// loop lx
let mut loop_lx = vec![];
let mut loop_rest = rest;
while peek(opt(LX::parse))(loop_rest)?.1.is_some() {
let (rest, lx) = LX::parse(loop_rest)?;
let (rest, l5) = L5::parse(rest)?;
let (rest, x1) = opt(X1::parse)(rest)?;
loop_rest = rest;
// loop l0
let mut loop_l0 = vec![];
while peek(opt(L0::parse))(loop_rest)?.1.is_some() {
let (rest, l0) = opt(L0::parse)(loop_rest)?;
let (rest, mea) = opt(MEA::parse)(rest)?;
let (rest, l1) = opt(L1::parse)(rest)?;
let (rest, pi) = opt(PI::parse)(rest)?;
loop_rest = rest;
loop_l0.push(_404LoopL0 { l0, mea, l1, pi });
}
loop_lx.push(_404LoopLX {
lx,
l5,
loop_l0,
x1,
});
}
output.loop_lx = loop_lx;
let rest = loop_rest;
let (rest, obj) = opt(L3::parse)(rest)?;
output.l3 = obj;
let (rest, obj) = opt(LS::parse)(rest)?;
output.ls = obj;
// loop lh1
let mut loop_lh1 = vec![];
let mut loop_rest = rest;
while peek(opt(LH1::parse))(loop_rest)?.1.is_some() {
let (rest, lh1) = opt(LH1::parse)(loop_rest)?;
let (rest, lh2) = many0(LH2::parse)(rest)?;
let (rest, lh3) = many0(LH3::parse)(rest)?;
let (rest, lfh) = many0(LFH::parse)(rest)?;
let (rest, lep) = opt(LEP::parse)(rest)?;
let (rest, lh4) = opt(LH4::parse)(rest)?;
let (rest, lht) = opt(LHT::parse)(rest)?;
let (rest, lhr) = opt(LHR::parse)(rest)?;
let (rest, per) = opt(PER::parse)(rest)?;
loop_rest = rest;
loop_lh1.push(_404LoopLH1 {
lh1,
lh2,
lh3,
lfh,
lep,
lh4,
lht,
lhr,
per,
});
}
output.loop_lh1 = loop_lh1;
let rest = loop_rest;
let (rest, obj) = opt(LE::parse)(rest)?;
output.le = obj;
let (rest, obj) = opt(PER::parse)(rest)?;
output.per = obj;
let (rest, obj) = opt(LH2::parse)(rest)?;
output.lh2 = obj;
let (rest, obj) = opt(LHR::parse)(rest)?;
output.lhr = obj;
let (rest, obj) = opt(LH6::parse)(rest)?;
output.lh6 = obj;
let (rest, obj) = opt(XH::parse)(rest)?;
output.xh = obj;
let (rest, obj) = opt(X7::parse)(rest)?;
output.x7 = obj;
let (rest, obj) = SE::parse(rest)?;
output.se = obj;
Ok((rest, output))
}
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopN7 {
pub n7: N7,
pub em: Option<EM>,
pub loop_vc: Vec<_404LoopVC>,
pub m7: Option<M7>,
pub n5: Option<N5>,
pub ic: Option<IC>,
pub im: Option<IM>,
pub m12: Option<M12>,
pub loop_e1: Vec<_404LoopN7E1>,
pub ga: Option<GA>,
pub loop_ref: Vec<_404LoopN7Ref>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopN7Ref {
pub _ref: Option<REF>,
pub n10: Option<N10>,
pub loop_n1: Vec<_404LoopN7RefN1>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopN7RefN1 {
pub n1: Option<N1>,
pub n3: Option<N3>,
pub n4: Option<N4>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopVC {
pub vc: Option<VC>,
pub loop_n1: Vec<_404LoopVcN1>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopVcN1 {
pub n1: Option<N1>,
pub n3: Option<N3>,
pub n4: Option<N4>,
pub h3: Option<H3>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopN1 {
pub n1: N1,
pub n2: Option<N2>,
pub n3: Option<N3>,
pub n4: Option<N4>,
pub r#ref: Option<REF>,
pub per: Option<PER>,
pub bl: Option<BL>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopS1 {
pub s1: Option<S1>,
pub s2: Option<S2>,
pub s9: Option<S9>,
pub n1: Option<N1>,
pub n2: Option<N2>,
pub n3: Option<N3>,
pub n4: Option<N4>,
pub per: Option<PER>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopN7E1 {
pub e1: E1,
pub e4: Option<E4>,
pub e5: Option<E5>,
pub pi: Option<PI>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopE1 {
pub e1: E1,
pub e4: Option<E4>,
pub e5: Option<E5>,
pub pi: Option<PI>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopL0 {
pub l0: Option<L0>,
pub mea: Option<MEA>,
pub l1: Option<L1>,
pub pi: Option<PI>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopT1 {
pub t1: Option<T1>,
pub t2: Option<T2>,
pub t3: Option<T3>,
pub t6: Option<T6>,
pub t8: Option<T8>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopLH1 {
pub lh1: Option<LH1>,
pub lh2: Vec<LH2>,
pub lh3: Vec<LH3>,
pub lfh: Vec<LFH>,
pub lep: Option<LEP>,
pub lh4: Option<LH4>,
pub lht: Option<LHT>,
pub lhr: Option<LHR>,
pub per: Option<PER>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopLX {
pub lx: LX,
pub l5: L5,
pub loop_l0: Vec<_404LoopL0>,
pub x1: Option<X1>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopRef {
pub _ref: Option<REF>,
pub n10: Option<N10>,
pub loop_n1: Vec<_404LoopRefN1>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, DisplayX12)]
pub struct _404LoopRefN1 {
pub n1: Option<N1>,
pub n3: Option<N3>,
pub n4: Option<N4>,
}
/// 997 - Functional Acknowledgment
///
/// This Draft Standard for Trial Use contains the format and establishes the data contents of the Functional Acknowledgment Transaction Set (997) for use within the context of an Electronic Data Interchange (EDI) environment. The transaction set can be used to define the control structures for a set of acknowledgments to indicate the results of the syntactical analysis of the electronically encoded documents. The encoded documents are the transaction sets, which are grouped in functional groups, used in defining transactions for business data interchange. This standard does not cover the semantic meaning of the information encoded in the transaction sets.
///
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 0010 | ST | Transaction Set Header | M | 1 | |
/// 0020 | AK1 | Functional Group Response Header | M | 1 | |
/// LOOP ID - AK2 | 999999
/// AK2 -> 0030 | AK2 | Transaction Set Response Header | O | 1 | |
/// AK2 -> LOOP ID - AK3 | 999999 |
/// AK2 -> AK3 -> 0040 | AK3 | Data Segment Note | O | 1 | |
/// AK2 -> AK3 -> 0050 | AK4 | Data Element Note | O | 99 | |
/// AK2 -> 0060 | AK5 | Transaction Set Response Trailer | M | 1 | |
/// 0070 | AK9 | Functional Group Response Trailer | M | 1 | |
/// 0080 | SE | Transaction Set Trailer | M | 1 |
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _997 {
pub st: ST,
pub ak1: AK1,
pub loop_ak2: Vec<_997LoopAk2>,
pub ak9: AK9,
pub se: SE,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _997LoopAk2 {
pub ak2: AK2,
pub loop_ak3: Vec<_997LoopAk3>,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _997LoopAk3 {
pub ak3: Option<AK3>,
pub ak4: Vec<AK4>,
}
/// 998 - Set Cancellation
///
/// This X12 Transaction Set contains the format and establishes the data contents of the Set Cancellation Transaction Set (998) for use within the context of an Electronic Data Interchange (EDI) environment. The transaction set can be used to request the deletion of a previously transmitted transaction set and will indicate the reason for this action, such as diversion or cancelled bill.
/// POS | ID | NAME | REQ | MAX | REPEAT
/// ----|----|------|-----|-----|-------
/// 0100 | ST | Transaction Set Header | M | 1
/// 0200 | ZD | Transaction Set Deletion - ID, Reason, and Source | M | 1
/// 0300 | SE | Transaction Set Trailer | M | 1
#[derive(Serialize, Deserialize, Clone, Default, Debug, DisplayX12)]
pub struct _998 {
pub st: ST,
pub zd: ZD,
pub se: SE,
}
impl<'a> Parser<&'a str, _998, nom::error::Error<&'a str>> for _998 {
fn parse(input: &'a str) -> IResult<&'a str, _998> {
let mut output = _998::default();
let (input, obj) = ST::parse(input)?;
output.st = obj;
let (input, obj) = ZD::parse(input)?;
output.zd = obj;
let (input, obj) = SE::parse(input)?;
output.se = obj;
Ok((input, output))
}
}