# frozen_string_literal: true
module Stupidedi
  module TransactionSets
    module FiftyTen
      module Implementations
        module X220A1
          b = Builder
          d = Schema
          r = SegmentReqs
          e = ElementReqs
          s = SegmentDefs

          BE834 = b.build("BE", "834", "",
            d::TableDef.header("1 - Header",
              b::Segment(100, s::ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
                b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("834")),
                b::Element(e::Required,    "Transaction Set Control Number"),
                b::Element(e::Required,    "Implementation Convention Reference", b::Values("005010X220A1"))),
              b::Segment(200, s::BGN, "Beginning Segment", r::Required, d::RepeatCount.bounded(1),
                b::Element(e::Required,    "Transaction Set Purpose Code", b::Values("00", "15", "22")),
                b::Element(e::Required,    "Transaction Set Reference Number", b::MaxLength(50)),
                b::Element(e::Required,    "Transaction Set Creation Date"),
                b::Element(e::Required,    "Transaction Set Creation Time"),
                b::Element(e::Situational, "Time Zone Code"),
                b::Element(e::Situational, "Original Transaction Set Reference Number"),
                b::Element(e::NotUsed,     "Transaction Type Code"),
                b::Element(e::Required,    "Action Code", b::Values("2", "4", "RX")),
                b::Element(e::NotUsed,     "Security Level Code")),
              b::Segment(300, s::REF, "Transaction Set Policy Number", r::Situational, d::RepeatCount.bounded(1),
                b::Element(e::Required,    "Reference Identification Qualifier", b::Values("38")),
                b::Element(e::Required,    "Master Policy Number", b::MaxLength(50)),
                b::Element(e::NotUsed,     "Description"),
                b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
              b::Segment(400, s::DTP, "File Effective Date", r::Situational, d::RepeatCount.bounded(2),
                b::Element(e::Required,    "Date Time Qualifier", b::Values("007", "090", "091", "303", "382", "388")),
                b::Element(e::Required,    "Date Time Period Format Qualifier", b::Values("D8")),
                b::Element(e::Required,    "Date Time Period", b::MaxLength(8))),
              b::Segment(600, s::QTY, "Transaction Set Control Totals", r::Situational, d::RepeatCount.bounded(3),
                b::Element(e::Required,    "Quantity Qualifier", b::Values("DT", "ET", "TO")),
                b::Element(e::Required,    "Record Totals", b::MaxLength(15)),
                b::Element(e::NotUsed,     "Composite Unit of Measure"),
                b::Element(e::NotUsed,     "Free-form Information")),

              d::LoopDef.build("1000A - SPONSOR NAME", d::RepeatCount.bounded(1),
                b::Segment(700, s::N1, "Sponsor Name", r::Required, d::RepeatCount.bounded(1),
                  b::Element(e::Required,    "Entity Identifier Code", b::Values("P5")),
                  b::Element(e::Situational, "Plan Sponsor Name", b::MaxLength(60)),
                  b::Element(e::Required,    "Identification Code Qualifier", b::Values("24", "94", "FI")),
                  b::Element(e::Required,    "Sponsor Identifier", b::MaxLength(80)),
                  b::Element(e::NotUsed,     "Entity Relationship Code"),
                  b::Element(e::NotUsed,     "Entity Identifier Code"))),

              d::LoopDef.build("1000B - PAYER", d::RepeatCount.bounded(1),
                b::Segment(700, s::N1, "Payer", r::Required, d::RepeatCount.bounded(1),
                  b::Element(e::Required,    "Entity Identifier Code", b::Values("IN")),
                  b::Element(e::Situational, "Insurer Name", b::MaxLength(60)),
                  b::Element(e::Required,    "Identification Code Qualifier", b::Values("94", "FI", "XV")),
                  b::Element(e::Required,    "Insurer Identification Code", b::MaxLength(80)),
                  b::Element(e::NotUsed,     "Entity Relationship Code"),
                  b::Element(e::NotUsed,     "Entity Identifier Code"))),

              d::LoopDef.build("1000C - TPA/BROKER NAME", d::RepeatCount.bounded(2),
                b::Segment(700, s::N1, "TPA/Broker Name", r::Situational, d::RepeatCount.bounded(1),
                  b::Element(e::Required,    "Entity Identifier Code", b::Values("BO", "TV")),
                  b::Element(e::Situational, "TPA or Broker Name", b::MaxLength(60)),
                  b::Element(e::Required,    "Identification Code Qualifier", b::Values("94", "FI", "XV")),
                  b::Element(e::Required,    "TPA or Broker Identification Code", b::MaxLength(80)),
                  b::Element(e::NotUsed,     "Entity Relationship Code"),
                  b::Element(e::NotUsed,     "Entity Identifier Code"))),

              d::LoopDef.build("1100C - TPA/BROKER ACCOUNT INFORMATION", d::RepeatCount.bounded(1),
                b::Segment(1200, s::ACT, "TPA/Broker Account Information", r::Situational, d::RepeatCount.bounded(1),
                  b::Element(e::Required,    "TPA or Broker Account Number", b::MaxLength(35)),
                  b::Element(e::NotUsed,     "Name"),
                  b::Element(e::NotUsed,     "Identification Code Qualifier"),
                  b::Element(e::NotUsed,     "Identification Code"),
                  b::Element(e::NotUsed,     "Account Number Qualifier"),
                  b::Element(e::Situational, "TPA or Broker Account Number", b::MaxLength(35)),
                  b::Element(e::NotUsed,     "Description"),
                  b::Element(e::NotUsed,     "Payment Method Type Code"),
                  b::Element(e::NotUsed,     "Benefit Status Code")))),

            d::TableDef.detail("2 - Detail",
              d::LoopDef.build("2000 - MEMBER LEVEL DETAIL", d::RepeatCount.unbounded,
                b::Segment(100, s::INS, "Member Level Detail", r::Required, d::RepeatCount.bounded(1),
                  b::Element(e::Required,    "Member Indicator", b::Values("N", "Y")),
                  b::Element(e::Required,    "Individual Relationship Code", b::Values("01", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "23", "24", "25", "26", "31", "38", "53", "60", "D2", "G8", "G9")),
                  b::Element(e::Required,    "Maintenance Type Code", b::Values("001", "021", "024", "025", "030")),
                  b::Element(e::Situational, "Maintenance Reason Code", b::Values("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "14", "15", "16", "17", "18", "20", "21", "22", "25", "26", "27", "28", "29", "31", "32", "33", "37", "38", "39", "40", "41", "43", "59", "AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ", "AL", "EC", "XN", "XT")),
                  b::Element(e::Required,    "Benefit Status Code", b::Values("A", "C", "S", "T")),
                  b::Element(e::Situational, "MEDICARE STATUS CODE",
                    b::Element(e::Required,    "Medicare Plan Code", b::Values("A", "B", "C", "D", "E")),
                    b::Element(e::Situational, "Medicare Eligibility Reason Code", b::Values("0", "1", "2")),
                    b::Element(e::NotUsed,     "Eligibility Reason Code"),
                    b::Element(e::NotUsed,     "Eligibility Reason Code")),
                  b::Element(e::Situational, "Consolidated Omnibus Budget Reconciliation Act (COBRA) Qualifying Event Code", b::Values("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "ZZ")),
                  b::Element(e::Situational, "Employment Status Code", b::Values("AC", "AO", "AU", "FT", "L1", "PT", "RT", "TE")),
                  b::Element(e::Situational, "Student Status Code", b::Values("F", "N", "P")),
                  b::Element(e::Situational, "Handicap Indicator", b::Values("N", "Y")),
                  b::Element(e::Situational, "Date Time Period Format Qualifier", b::Values("D8")),
                  b::Element(e::Situational, "Member Individual Death Date"),
                  b::Element(e::Situational, "Confidentiality Code", b::Values("R", "U")),
                  b::Element(e::NotUsed,     "City Name"),
                  b::Element(e::NotUsed,     "State or Province Code"),
                  b::Element(e::NotUsed,     "Country Code"),
                  b::Element(e::Situational, "Birth Sequence Number")),
                b::Segment(200, s::REF, "Subscriber Identifier", r::Required, d::RepeatCount.bounded(1),
                  b::Element(e::Required,    "Reference Identification Qualifier", b::Values("0F")),
                  b::Element(e::Required,    "Subscriber Identifier", b::MaxLength(50)),
                  b::Element(e::NotUsed,     "Description"),
                  b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
                b::Segment(200, s::REF, "Member Policy Number", r::Situational, d::RepeatCount.bounded(1),
                  b::Element(e::Required,    "Reference Identification Qualifier", b::Values("1L")),
                  b::Element(e::Required,    "Member Group or Policy Number", b::MaxLength(50)),
                  b::Element(e::NotUsed,     "Description"),
                  b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
                b::Segment(200, s::REF, "Member Supplemental Identifier", r::Situational, d::RepeatCount.bounded(13),
                  b::Element(e::Required,    "Reference Identification Qualifier", b::Values("17", "23", "3H", "4A", "6O", "ABB", "D3", "DX", "F6", "P5", "Q4", "QQ", "ZZ")),
                  b::Element(e::Required,    "Member Supplemental Identifier", b::MaxLength(50)),
                  b::Element(e::NotUsed,     "Description"),
                  b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
                b::Segment(250, s::DTP, "Member Level Dates", r::Situational, d::RepeatCount.bounded(24),
                  b::Element(e::Required,    "Date Time Qualifier", b::Values("050", "286", "296", "297", "300", "301", "303", "336", "337", "338", "339", "340", "341", "350", "351", "356", "357", "383", "385", "386", "393", "394", "473", "474")),
                  b::Element(e::Required,    "Date Time Period Format Qualifier", b::Values("D8")),
                  b::Element(e::Required,    "Status Information Effective Date")),

                d::LoopDef.build("2100A - MEMBER", d::RepeatCount.bounded(1),
                  b::Segment(300, s::NM1, "Member Name", r::Required, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Entity Identifier Code", b::Values("74", "IL")),
                    b::Element(e::Required,    "Entity Type Qualifier", b::Values("1")),
                    b::Element(e::Required,    "Member Last Name", b::MaxLength(60)),
                    b::Element(e::Situational, "Member First Name", b::MaxLength(35)),
                    b::Element(e::Situational, "Member Middle Name", b::MaxLength(25)),
                    b::Element(e::Situational, "Member Name Prefix", b::MaxLength(10)),
                    b::Element(e::Situational, "Member Name Suffix", b::MaxLength(10)),
                    b::Element(e::Situational, "Identification Code Qualifier", b::Values("34", "ZZ")),
                    b::Element(e::Situational, "Member Identifier", b::MaxLength(80)),
                    b::Element(e::NotUsed,     "Entity Relationship Code"),
                    b::Element(e::NotUsed,     "Entity Identifier Code"),
                    b::Element(e::NotUsed,     "Name Last or Organization Name")),
                  b::Segment(400, s::PER, "Member Communications Numbers", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Contact Function Code", b::Values("IP")),
                    b::Element(e::NotUsed,     "Name"),
                    b::Element(e::Required,    "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "HP", "TE", "WP")),
                    b::Element(e::Required,    "Communication Number", b::MaxLength(256)),
                    b::Element(e::Situational, "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "HP", "TE", "WP")),
                    b::Element(e::Situational, "Communication Number", b::MaxLength(256)),
                    b::Element(e::Situational, "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "HP", "TE", "WP")),
                    b::Element(e::Situational, "Communication Number", b::MaxLength(256)),
                    b::Element(e::NotUsed,     "Contact Inquiry Reference")),
                  b::Segment(500, s::N3, "Member Residence Street Address", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Member Address Line", b::MaxLength(55)),
                    b::Element(e::Situational, "Member Address Line", b::MaxLength(55))),
                  b::Segment(600, s::N4, "Member City, State, Zip Code", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Member City Name"),
                    b::Element(e::Situational, "Member State Code"),
                    b::Element(e::Situational, "Member Postal Zone or Zip Code"),
                    b::Element(e::Situational, "Country Code"),
                    b::Element(e::Situational, "Location Qualifier", b::Values("60", "CY")),
                    b::Element(e::Situational, "Location Identifier"),
                    b::Element(e::Situational, "Country Subdivision Code")),
                  b::Segment(800, s::DMG, "Member Demographics", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Date Time Period Format Qualifier", b::Values("D8")),
                    b::Element(e::Required,    "Member Birth Date"),
                    b::Element(e::Required,    "Gender Code", b::Values("F", "M", "U")),
                    b::Element(e::Situational, "Marital Status Code", b::Values("B", "D", "I", "M", "R", "S", "U", "W", "X")),
                    b::Element(e::Situational, "COMPOSITE RACE OR ETHNICITY INFORMATION",
                      b::Element(e::Situational, "Race or Ethnicity Code", b::Values("7", "8", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "N", "O", "P", "Z")),
                      b::Element(e::Situational, "Code List Qualifier Code", b::Values("RET")),
                      b::Element(e::Situational, "Race or Ethnicity Code")),
                    b::Element(e::Situational, "Citizenship Status Code", b::Values("1", "2", "3", "4", "5", "6", "7")),
                    b::Element(e::NotUsed,     "Country Code"),
                    b::Element(e::NotUsed,     "Basis of Verification Code"),
                    b::Element(e::NotUsed,     "Quantity"),
                    b::Element(e::Situational, "Code List Qualifier Code", b::Values("REC")),
                    b::Element(e::Situational, "Race or Ethnicity Collection Code")),
                  b::Segment(1000, s::EC, "Employment Class", r::Situational, d::RepeatCount.unbounded,
                    b::Element(e::Required,    "Employment Class Code", b::Values("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "17", "18", "19", "20", "21", "22", "23")),
                    b::Element(e::Situational, "Employment Class Code", b::Values("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "17", "18", "19", "20", "21", "22", "23")),
                    b::Element(e::Situational, "Employment Class Code", b::Values("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "17", "18", "19", "20", "21", "22", "23")),
                    b::Element(e::NotUsed,     "Percentage as Decimal"),
                    b::Element(e::NotUsed,     "Information Status Code"),
                    b::Element(e::NotUsed,     "Occupation Code")),
                  b::Segment(1100, s::ICM, "Member Income", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Frequency Code", b::Values("1", "2", "3", "4", "6", "7", "8", "9", "B", "C", "H", "Q", "S", "U")),
                    b::Element(e::Required,    "Wage Amount"),
                    b::Element(e::Situational, "Work Hours Count"),
                    b::Element(e::Situational, "Location Identification Code"),
                    b::Element(e::Situational, "Salary Grade Code"),
                    b::Element(e::NotUsed,     "Currency Code")),
                  b::Segment(1200, s::AMT, "Member Policy Amounts", r::Situational, d::RepeatCount.bounded(7),
                    b::Element(e::Required,    "Amount Qualifier Code", b::Values("B9", "C1", "D2", "EBA", "FK", "P3", "R")),
                    b::Element(e::Required,    "Contract Amount"),
                    b::Element(e::NotUsed,     "Credit/Debit Flag Code")),
                  b::Segment(1300, s::HLH, "Member Health Information", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Health Related Code", b::Values("N", "S", "T", "U", "X")),
                    b::Element(e::Situational, "Member Height"),
                    b::Element(e::Situational, "Member Weight"),
                    b::Element(e::NotUsed,     "Weight"),
                    b::Element(e::NotUsed,     "Description"),
                    b::Element(e::NotUsed,     "Current Health Condition Code"),
                    b::Element(e::NotUsed,     "Description")),
                  b::Segment(1500, s::LUI, "Member Language", r::Situational, d::RepeatCount.unbounded,
                    b::Element(e::Situational, "Identification Code Qualifier", b::Values("LD", "LE")),
                    b::Element(e::Situational, "Language Code"),
                    b::Element(e::Situational, "Language Description"),
                    b::Element(e::Situational, "Language Use Indicator", b::Values("5", "6", "7", "8")),
                    b::Element(e::NotUsed,     "Language Proficiency Indicator"))),

                d::LoopDef.build("2100B - INCORRECT MEMBER NAME", d::RepeatCount.bounded(1),
                  b::Segment(300, s::NM1, "Incorrect Member Name", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Entity Identifier Code", b::Values("70")),
                    b::Element(e::Required,    "Entity Type Qualifier", b::Values("1")),
                    b::Element(e::Required,    "Prior Incorrect Member Last Name"),
                    b::Element(e::Situational, "Prior Incorrect Member First Name"),
                    b::Element(e::Situational, "Prior Incorrect Member Middle Name"),
                    b::Element(e::Situational, "Prior Incorrect Member Name Prefix"),
                    b::Element(e::Situational, "Prior Incorrect Member Name Suffix"),
                    b::Element(e::Situational, "Identification Code Qualifier", b::Values("34", "ZZ")),
                    b::Element(e::Situational, "Prior Incorrect Insured Identifier"),
                    b::Element(e::NotUsed,     "Entity Relationship Code"),
                    b::Element(e::NotUsed,     "Entity Identifier Code"),
                    b::Element(e::NotUsed,     "Name Last or Organization Name")),
                  b::Segment(800, s::DMG, "Incorrect Member Demographics", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Situational, "Date Time Period Format Qualifier", b::Values("D8")),
                    b::Element(e::Situational, "Prior Incorrect Insured Birth Date"),
                    b::Element(e::Situational, "Prior Incorrect Insured Gender Code", b::Values("F", "M", "U")),
                    b::Element(e::Situational, "Marital Status Code", b::Values("B", "D", "I", "M", "R", "S", "U", "W", "X")),
                    b::Element(e::Situational, "COMPOSITE RACE OR ETHNICITY INFORMATION",
                      b::Element(e::Situational, "Race or Ethnicity Code"),
                      b::Element(e::Situational, "Code List Qualifier Code"),
                      b::Element(e::Situational, "Race or Ethnicity Code")),
                    b::Element(e::Situational, "Citizenship Status Code"),
                    b::Element(e::NotUsed,     "Country Code"),
                    b::Element(e::NotUsed,     "Basis of Verification Code"),
                    b::Element(e::NotUsed,     "Quantity"),
                    b::Element(e::Situational, "Code List Qualifier Code"),
                    b::Element(e::Situational, "Race or Ethnicity Collection Code"))),

                d::LoopDef.build("2100C - MEMBER MAILING ADDRESS", d::RepeatCount.bounded(1),
                  b::Segment(300, s::NM1, "Member Mailing Address", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Entity Identifier Code", b::Values("31")),
                    b::Element(e::Required,    "Entity Type Qualifier", b::Values("1")),
                    b::Element(e::NotUsed,     "Name Last or Organization Name"),
                    b::Element(e::NotUsed,     "Name First"),
                    b::Element(e::NotUsed,     "Name Middle"),
                    b::Element(e::NotUsed,     "Name Prefix"),
                    b::Element(e::NotUsed,     "Name Suffix"),
                    b::Element(e::NotUsed,     "Identification Code Qualifier"),
                    b::Element(e::NotUsed,     "Identification Code"),
                    b::Element(e::NotUsed,     "Entity Relationship Code"),
                    b::Element(e::NotUsed,     "Entity Identifier Code"),
                    b::Element(e::NotUsed,     "Name Last or Organization Name")),
                  b::Segment(500, s::N3, "Member Mail Street Address", r::Required, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Member Address Line", b::MaxLength(55)),
                    b::Element(e::Situational, "Member Address Line", b::MaxLength(55))),
                  b::Segment(600, s::N4, "Member Mail City, State, Zip Code", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Member Mail City Name"),
                    b::Element(e::Situational, "Member Mail State Code"),
                    b::Element(e::Situational, "Member Mail Postal Zone or Zip Code"),
                    b::Element(e::Situational, "Country Code"),
                    b::Element(e::NotUsed,     "Location Qualifier"),
                    b::Element(e::NotUsed,     "Location Identifier"),
                    b::Element(e::Situational, "Country Subdivision Code"))),

                d::LoopDef.build("2100D - MEMBER EMPLOYER", d::RepeatCount.bounded(3),
                  b::Segment(300, s::NM1, "Member Employer", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Entity Identifier Code", b::Values("36")),
                    b::Element(e::Required,    "Entity Type Qualifier", b::Values("1", "2")),
                    b::Element(e::Situational, "Member Employer Name"),
                    b::Element(e::Situational, "Member Employer First Name"),
                    b::Element(e::Situational, "Member Employer Middle Name"),
                    b::Element(e::Situational, "Member Employer Name Prefix"),
                    b::Element(e::Situational, "Member Employer Name Suffix"),
                    b::Element(e::Situational, "Identification Code Qualifier", b::Values("24", "34")),
                    b::Element(e::Situational, "Member Employer Identifier"),
                    b::Element(e::NotUsed,     "Entity Relationship Code"),
                    b::Element(e::NotUsed,     "Entity Identifier Code"),
                    b::Element(e::NotUsed,     "Name Last or Organization Name")),
                  b::Segment(400, s::PER, "Member Employer Communications Numbers", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Contact Function Code", b::Values("EP")),
                    b::Element(e::Situational, "Member Employer Communications Contact Name"),
                    b::Element(e::Required,    "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "TE")),
                    b::Element(e::Required,    "Communication Number", b::MaxLength(256)),
                    b::Element(e::Situational, "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "TE")),
                    b::Element(e::Situational, "Communication Number", b::MaxLength(256)),
                    b::Element(e::Situational, "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "TE")),
                    b::Element(e::Situational, "Communication Number", b::MaxLength(256)),
                    b::Element(e::NotUsed,     "Contact Inquiry Reference")),
                  b::Segment(500, s::N3, "Member Employer Street Address", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Member Employer Address Line", b::MaxLength(55)),
                    b::Element(e::Situational, "Member Employer Address Line", b::MaxLength(55))),
                  b::Segment(600, s::N4, "Member Employer City, State, Zip Code", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Member Employer City Name"),
                    b::Element(e::Situational, "Member Employer State Code"),
                    b::Element(e::Situational, "Member Employer Postal Zone or Zip Code"),
                    b::Element(e::Situational, "Country Code"),
                    b::Element(e::NotUsed,     "Location Qualifier"),
                    b::Element(e::NotUsed,     "Location Identifier"),
                    b::Element(e::Situational, "Country Subdivision Code"))),

                d::LoopDef.build("2100E - MEMBER SCHOOL", d::RepeatCount.bounded(3),
                  b::Segment(300, s::NM1, "Member School", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Entity Identifier Code", b::Values("M8")),
                    b::Element(e::Required,    "Entity Type Qualifier", b::Values("2")),
                    b::Element(e::Required,    "School Name"),
                    b::Element(e::NotUsed,     "Name First"),
                    b::Element(e::NotUsed,     "Name Middle"),
                    b::Element(e::NotUsed,     "Name Prefix"),
                    b::Element(e::NotUsed,     "Name Suffix"),
                    b::Element(e::NotUsed,     "Identification Code Qualifier"),
                    b::Element(e::NotUsed,     "Identification Code"),
                    b::Element(e::NotUsed,     "Entity Relationship Code"),
                    b::Element(e::NotUsed,     "Entity Identifier Code"),
                    b::Element(e::NotUsed,     "Name Last or Organization Name")),
                  b::Segment(400, s::PER, "Member School Communications Numbers", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Contact Function Code", b::Values("SK")),
                    b::Element(e::Situational, "Member School Communications Contact Name"),
                    b::Element(e::Required,    "Communication Number Qualifier", b::Values("EM", "EX", "FX", "TE")),
                    b::Element(e::Required,    "Communication Number", b::MaxLength(256)),
                    b::Element(e::Situational, "Communication Number Qualifier", b::Values("EM", "EX", "FX", "TE")),
                    b::Element(e::Situational, "Communication Number", b::MaxLength(256)),
                    b::Element(e::Situational, "Communication Number Qualifier", b::Values("EM", "EX", "FX", "TE")),
                    b::Element(e::Situational, "Communication Number", b::MaxLength(256)),
                    b::Element(e::NotUsed,     "Contact Inquiry Reference")),
                  b::Segment(500, s::N3, "Member School Street Address", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "School Address Line", b::MaxLength(55)),
                    b::Element(e::Situational, "School Address Line", b::MaxLength(55))),
                  b::Segment(600, s::N4, "Member School City, State, Zip Code", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Member School City Name"),
                    b::Element(e::Situational, "Member School State Code"),
                    b::Element(e::Situational, "Member School Postal Zone or Zip Code"),
                    b::Element(e::Situational, "Country Code"),
                    b::Element(e::NotUsed,     "Location Qualifier"),
                    b::Element(e::NotUsed,     "Location Identifier"),
                    b::Element(e::Situational, "Country Subdivision Code"))),

                d::LoopDef.build("2100F - CUSTODIAL PARENT", d::RepeatCount.bounded(1),
                  b::Segment(300, s::NM1, "Custodial Parent", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Entity Identifier Code", b::Values("S3")),
                    b::Element(e::Required,    "Entity Type Qualifier", b::Values("1")),
                    b::Element(e::Required,    "Custodial Parent Last Name"),
                    b::Element(e::Required,    "Custodial Parent First Name"),
                    b::Element(e::Situational, "Custodial Parent Middle Name"),
                    b::Element(e::Situational, "Custodial Parent Name Prefix"),
                    b::Element(e::Situational, "Custodial Parent Name Suffix"),
                    b::Element(e::Situational, "Identification Code Qualifier", b::Values("34", "ZZ")),
                    b::Element(e::Situational, "Custodial Parent Identifier"),
                    b::Element(e::NotUsed,     "Entity Relationship Code"),
                    b::Element(e::NotUsed,     "Entity Identifier Code"),
                    b::Element(e::NotUsed,     "Name Last or Organization Name")),
                  b::Segment(400, s::PER, "Custodial Parent Communications Numbers", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Contact Function Code", b::Values("PQ")),
                    b::Element(e::NotUsed,     "Name"),
                    b::Element(e::Required,    "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "HP", "TE", "WP")),
                    b::Element(e::Required,    "Communication Number", b::MaxLength(256)),
                    b::Element(e::Situational, "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "HP", "TE", "WP")),
                    b::Element(e::Situational, "Communication Number", b::MaxLength(256)),
                    b::Element(e::Situational, "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "HP", "TE", "WP")),
                    b::Element(e::Situational, "Communication Number", b::MaxLength(256)),
                    b::Element(e::NotUsed,     "Contact Inquiry Reference")),
                  b::Segment(500, s::N3, "Custodial Parent Street Address", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Custodial Parent Address Line", b::MaxLength(55)),
                    b::Element(e::Situational, "Custodial Parent Address Line", b::MaxLength(55))),
                  b::Segment(600, s::N4, "Custodial Parent City, State, Zip Code", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Custodial Parent City Name"),
                    b::Element(e::Situational, "Custodial Parent State Code"),
                    b::Element(e::Situational, "Custodial Parent Postal Zone or Zip Code"),
                    b::Element(e::Situational, "Country Code"),
                    b::Element(e::NotUsed,     "Location Qualifier"),
                    b::Element(e::NotUsed,     "Location Identifier"),
                    b::Element(e::Situational, "Country Subdivision Code"))),

                d::LoopDef.build("2100G - RESPONSIBLE PERSON", d::RepeatCount.bounded(13),
                  b::Segment(300, s::NM1, "Responsible Person", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Entity Identifier Code", b::Values("6Y", "9K", "E1", "EI", "EXS", "GB", "GD", "J6", "LR", "QD", "S1", "TZ", "X4")),
                    b::Element(e::Required,    "Entity Type Qualifier", b::Values("1")),
                    b::Element(e::Required,    "Responsible Party Last or Organization Name"),
                    b::Element(e::Situational, "Responsible Party First Name"),
                    b::Element(e::Situational, "Responsible Party Middle Name"),
                    b::Element(e::Situational, "Responsible Party Name Prefix"),
                    b::Element(e::Situational, "Responsible Party Name Suffix"),
                    b::Element(e::Situational, "Identification Code Qualifier", b::Values("34", "ZZ")),
                    b::Element(e::Situational, "Responsible Party Identifier"),
                    b::Element(e::NotUsed,     "Entity Relationship Code"),
                    b::Element(e::NotUsed,     "Entity Identifier Code"),
                    b::Element(e::NotUsed,     "Name Last or Organization Name")),
                  b::Segment(400, s::PER, "Responsible Person Communications Numbers", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Contact Function Code", b::Values("RP")),
                    b::Element(e::NotUsed,     "Name"),
                    b::Element(e::Required,    "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "HP", "TE", "WP")),
                    b::Element(e::Required,    "Communication Number", b::MaxLength(256)),
                    b::Element(e::Situational, "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "HP", "TE", "WP")),
                    b::Element(e::Situational, "Communication Number", b::MaxLength(256)),
                    b::Element(e::Situational, "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "HP", "TE", "WP")),
                    b::Element(e::Situational, "Communication Number", b::MaxLength(256)),
                    b::Element(e::NotUsed,     "Contact Inquiry Reference")),
                  b::Segment(500, s::N3, "Responsible Person Street Address", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Responsible Party Address Line", b::MaxLength(55)),
                    b::Element(e::Situational, "Responsible Party Address Line", b::MaxLength(55))),
                  b::Segment(600, s::N4, "Responsible Person City, State, Zip Code", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Responsible Person City Name"),
                    b::Element(e::Situational, "Responsible Person State Code"),
                    b::Element(e::Situational, "Responsible Person Postal Zone or Zip Code"),
                    b::Element(e::Situational, "Country Code"),
                    b::Element(e::NotUsed,     "Location Qualifier"),
                    b::Element(e::NotUsed,     "Location Identifier"),
                    b::Element(e::Situational, "Country Subdivision Code"))),

                d::LoopDef.build("2100H - DROP OFF LOCATION", d::RepeatCount.bounded(1),
                  b::Segment(300, s::NM1, "Drop Off Location", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Entity Identifier Code", b::Values("45")),
                    b::Element(e::Required,    "Entity Type Qualifier", b::Values("1")),
                    b::Element(e::Situational, "Name Last or Organization Name"),
                    b::Element(e::Situational, "Name First"),
                    b::Element(e::Situational, "Name Middle"),
                    b::Element(e::Situational, "Name Prefix"),
                    b::Element(e::Situational, "Name Suffix"),
                    b::Element(e::NotUsed,     "Identification Code Qualifier"),
                    b::Element(e::NotUsed,     "Identification Code"),
                    b::Element(e::NotUsed,     "Entity Relationship Code"),
                    b::Element(e::NotUsed,     "Entity Identifier Code"),
                    b::Element(e::NotUsed,     "Name Last or Organization Name")),
                  b::Segment(500, s::N3, "Drop Off Location Street Address", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Drop Off Location Address Line", b::MaxLength(55)),
                    b::Element(e::Situational, "Drop Off Location Address Line", b::MaxLength(55))),
                  b::Segment(600, s::N4, "Drop Off Location City, State, Zip Code", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Drop Off Location City Name"),
                    b::Element(e::Situational, "Drop Off Location State Code"),
                    b::Element(e::Situational, "Drop Off Location Postal Zone or Zip Code"),
                    b::Element(e::Situational, "Country Code"),
                    b::Element(e::NotUsed,     "Location Qualifier"),
                    b::Element(e::NotUsed,     "Location Identifier"),
                    b::Element(e::Situational, "Country Subdivision Code"))),

                d::LoopDef.build("2200 - DISABILITY INFORMATION", d::RepeatCount.unbounded,
                  b::Segment(2000, s::DSB, "Disability Information", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Disability Type Code", b::Values("1", "2", "3", "4")),
                    b::Element(e::NotUsed,     "Quantity"),
                    b::Element(e::NotUsed,     "Occupation Code"),
                    b::Element(e::NotUsed,     "Work Intensity Code"),
                    b::Element(e::NotUsed,     "Product Option Code"),
                    b::Element(e::NotUsed,     "Monetary Amount"),
                    b::Element(e::Situational, "Product or Service ID Qualifier", b::Values("DX", "ZZ")),
                    b::Element(e::Situational, "Diagnosis Code")),
                  b::Segment(2100, s::DTP, "Disability Eligibility Dates", r::Situational, d::RepeatCount.bounded(2),
                    b::Element(e::Required,    "Date Time Qualifier", b::Values("360", "361")),
                    b::Element(e::Required,    "Date Time Period Format Qualifier", b::Values("D8")),
                    b::Element(e::Required,    "Disability Eligibility Date"))),

                d::LoopDef.build("2300 - HEALTH COVERAGE", d::RepeatCount.bounded(99),
                  b::Segment(2600, s::HD, "Health Coverage", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Maintenance Type Code", b::Values("001", "002", "021", "024", "025", "026", "030", "032")),
                    b::Element(e::NotUsed,     "Maintenance Reason Code"),
                    b::Element(e::Required,    "Insurance Line Code", b::Values("AC", "ADD", "AG", "AH", "AJ", "AK", "DCP", "DEN", "EPO", "FAC", "HE", "HLT", "HMO", "LTC", "LTD", "LIF", "MM", "MOD", "PDG", "POS", "PPO", "PRA", "STD", "UR", "VIS")),
                    b::Element(e::Situational, "Plan Coverage Description"),
                    b::Element(e::Situational, "Coverage Level Code", b::Values("CHD", "DEP", "E1D", "E2D", "E3D", "E5D", "E6D", "E7D", "E8D", "E9D", "ECH", "EMP", "ESP", "FAM", "IND", "SPC", "SPO", "TWO")),
                    b::Element(e::NotUsed,     "Count"),
                    b::Element(e::NotUsed,     "Count"),
                    b::Element(e::NotUsed,     "Underwriting Decision Code"),
                    b::Element(e::Situational, "Late Enrollment Indicator"),
                    b::Element(e::NotUsed,     "Drug House Code"),
                    b::Element(e::NotUsed,     "Yes/No Condition or Response Code")),
                  b::Segment(2700, s::DTP, "Health Coverage Dates", r::Required, d::RepeatCount.bounded(6),
                    b::Element(e::Required,    "Date Time Qualifier", b::Values("300", "303", "343", "348", "349", "543", "695")),
                    b::Element(e::Required,    "Date Time Period Format Qualifier", b::Values("D8", "RD8")),
                    b::Element(e::Required,    "Coverage Period")),
                  b::Segment(2800, s::AMT, "Health Coverage Policy", r::Situational, d::RepeatCount.bounded(9),
                    b::Element(e::Required,    "Amount Qualifier Code", b::Values("B9", "C1", "D2", "EBA", "FK", "P3", "R")),
                    b::Element(e::Required,    "Contract Amount"),
                    b::Element(e::NotUsed,     "Credit/Debit Flag Code")),
                  b::Segment(2900, s::REF, "Health Coverage Policy Number", r::Situational, d::RepeatCount.bounded(14),
                    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("17", "1L", "9V", "CE", "E8", "M7", "PID", "RB", "X9", "XM", "XX1", "XX2", "ZX", "ZZ")),
                    b::Element(e::Required,    "Member Group or Policy Number", b::MaxLength(50)),
                    b::Element(e::NotUsed,     "Description"),
                    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
                  b::Segment(2900, s::REF, "Prior Coverage Months", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("QQ")),
                    b::Element(e::Required,    "Prior Coverage Month Count", b::MaxLength(50)),
                    b::Element(e::NotUsed,     "Description"),
                    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
                  b::Segment(3000, s::IDC, "Identification Card", r::Situational, d::RepeatCount.bounded(3),
                    b::Element(e::Required,    "Plan Coverage Description"),
                    b::Element(e::Required,    "Identification Card Type Code", b::Values("D", "H", "P")),
                    b::Element(e::Situational, "Identification Card Count"),
                    b::Element(e::Situational, "Action Code", b::Values("1", "2", "RX"))),

                  d::LoopDef.build("2310 - PROVIDER INFORMATION", d::RepeatCount.bounded(30),
                    b::Segment(3100, s::LX, "Provider Information", r::Situational, d::RepeatCount.bounded(1),
                      b::Element(e::Required,    "Assigned Number")),
                    b::Segment(3200, s::NM1, "Provider Name", r::Required, d::RepeatCount.bounded(1),
                      b::Element(e::Required,    "Entity Identifier Code", b::Values("1X", "3D", "80", "FA", "OD", "P3", "QA", "QN", "Y2")),
                      b::Element(e::Required,    "Entity Type Qualifier", b::Values("1", "2")),
                      b::Element(e::Situational, "Provider Last or Organization Name"),
                      b::Element(e::Situational, "Provider First Name"),
                      b::Element(e::Situational, "Provider Middle Name"),
                      b::Element(e::Situational, "Provider Name Prefix"),
                      b::Element(e::Situational, "Provider Name Suffix"),
                      b::Element(e::Situational, "Identification Code Qualifier", b::Values("34", "FI", "SV", "XX")),
                      b::Element(e::Situational, "Provider Identifier"),
                      b::Element(e::Required,    "Entity Relationship Code", b::Values("25", "26", "72")),
                      b::Element(e::NotUsed,     "Entity Identifier Code"),
                      b::Element(e::NotUsed,     "Name Last or Organization Name")),
                    b::Segment(3500, s::N3, "Provider Address", r::Situational, d::RepeatCount.bounded(2),
                      b::Element(e::Required,    "Provider Address Line", b::MaxLength(55)),
                      b::Element(e::Situational, "Provider Address Line", b::MaxLength(55))),
                    b::Segment(3600, s::N4, "Provider City, State, Zip Code", r::Situational, d::RepeatCount.bounded(1),
                      b::Element(e::Required,    "Provider City Name"),
                      b::Element(e::Situational, "Provider State Code"),
                      b::Element(e::Situational, "Provider Postal Zone or Zip Code"),
                      b::Element(e::Situational, "Country Code"),
                      b::Element(e::NotUsed,     "Location Qualifier"),
                      b::Element(e::NotUsed,     "Location Identifier"),
                      b::Element(e::Situational, "Country Subdivision Code")),
                    b::Segment(3700, s::PER, "Provider Communications Numbers", r::Situational, d::RepeatCount.bounded(2),
                      b::Element(e::Required,    "Contact Function Code", b::Values("IC")),
                      b::Element(e::NotUsed,     "Name"),
                      b::Element(e::Required,    "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "HP", "TE", "WP")),
                      b::Element(e::Required,    "Communication Number", b::MaxLength(256)),
                      b::Element(e::Situational, "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "HP", "TE", "WP")),
                      b::Element(e::Situational, "Communication Number", b::MaxLength(256)),
                      b::Element(e::Situational, "Communication Number Qualifier", b::Values("AP", "BN", "CP", "EM", "EX", "FX", "HP", "TE", "WP")),
                      b::Element(e::Situational, "Communication Number", b::MaxLength(256)),
                      b::Element(e::NotUsed,     "Contact Inquiry Reference")),
                    b::Segment(3950, s::PLA, "Provider Change Reason", r::Situational, d::RepeatCount.bounded(1),
                      b::Element(e::Required,    "Action Code", b::Values("2")),
                      b::Element(e::Required,    "Entity Identifier Code", b::Values("1P")),
                      b::Element(e::Required,    "Provider Effective Date"),
                      b::Element(e::NotUsed,     "Time"),
                      b::Element(e::Required,    "Maintenance Reason Code", b::Values("14", "22", "46", "AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ")))),

                  d::LoopDef.build("2320 - COORDINATION OF BENEFITS", d::RepeatCount.bounded(5),
                    b::Segment(4000, s::COB, "Coordination of Benefits", r::Situational, d::RepeatCount.bounded(1),
                      b::Element(e::Required,    "Payer Responsibility Sequence Number Code", b::Values("P", "S", "T", "U")),
                      b::Element(e::Situational, "Member Group or Policy Number", b::MaxLength(50)),
                      b::Element(e::Required,    "Coordination of Benefits Code", b::Values("1", "5", "6")),
                      b::Element(e::Situational, "Service Code", b::Values("1", "35", "48", "50", "54", "89", "90", "A4", "AG", "AL", "BB"))),
                    b::Segment(4050, s::REF, "Additional Coordination of Benefits Identifiers", r::Situational, d::RepeatCount.bounded(4),
                      b::Element(e::Required,    "Reference Identification Qualifier", b::Values("60", "6P", "SY", "ZZ")),
                      b::Element(e::Required,    "Member Group or Policy Number", b::MaxLength(50)),
                      b::Element(e::NotUsed,     "Description"),
                      b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
                    b::Segment(4070, s::DTP, "Coordination of Benefits Eligibility Dates", r::Situational, d::RepeatCount.bounded(2),
                      b::Element(e::Required,    "Date Time Qualifier", b::Values("344", "345")),
                      b::Element(e::Required,    "Date Time Period Format Qualifier", b::Values("D8")),
                      b::Element(e::Required,    "Coordination of Benefits Date")),

                    d::LoopDef.build("2330 - COORDINATION OF BENEFITS RELATED ENTITY", d::RepeatCount.bounded(3),
                      b::Segment(4100, s::NM1, "Coordination of Benefits Related Entity", r::Situational, d::RepeatCount.bounded(1),
                        b::Element(e::Required,    "Entity Identifier Code", b::Values("36", "GW", "IN")),
                        b::Element(e::Required,    "Entity Type Qualifier", b::Values("2")),
                        b::Element(e::Situational, "Coordination of Benefits Insurer Name"),
                        b::Element(e::NotUsed,     "Name First"),
                        b::Element(e::NotUsed,     "Name Middle"),
                        b::Element(e::NotUsed,     "Name Prefix"),
                        b::Element(e::NotUsed,     "Name Suffix"),
                        b::Element(e::Situational, "Identification Code Qualifier", b::Values("FI", "NI", "XV")),
                        b::Element(e::Situational, "Coordination of Benefits Insurer Identification Code"),
                        b::Element(e::NotUsed,     "Entity Relationship Code"),
                        b::Element(e::NotUsed,     "Entity Identifier Code"),
                        b::Element(e::NotUsed,     "Name Last or Organization Name")),
                      b::Segment(4300, s::N3, "Coordination of Benefits Related Entity Address", r::Situational, d::RepeatCount.bounded(1),
                        b::Element(e::Required,    "Address Information", b::MaxLength(55)),
                        b::Element(e::Situational, "Address Information", b::MaxLength(55))),
                      b::Segment(4400, s::N4, "Coordination of Benefits Other Insurance Company City, State, Zip Code", r::Situational, d::RepeatCount.bounded(1),
                        b::Element(e::Required,    "Coordination of Benefits Other Insurance Company City Name"),
                        b::Element(e::Situational, "Coordination of Benefits Other Insurance Company State Code"),
                        b::Element(e::Situational, "Coordination of Benefits Other Insurance Company Postal Zone or Zip Code"),
                        b::Element(e::Situational, "Country Code"),
                        b::Element(e::NotUsed,     "Location Qualifier"),
                        b::Element(e::NotUsed,     "Location Identifier"),
                        b::Element(e::Situational, "Country Subdivision Code")),
                      b::Segment(4500, s::PER, "Administrative Communications Contact", r::Situational, d::RepeatCount.bounded(1),
                        b::Element(e::Required,    "Contact Function Code", b::Values("CN")),
                        b::Element(e::NotUsed,     "Name"),
                        b::Element(e::Required,    "Communication Number Qualifier", b::Values("TE")),
                        b::Element(e::Required,    "Communication Number", b::MaxLength(256)),
                        b::Element(e::NotUsed,     "Communication Number Qualifier"),
                        b::Element(e::NotUsed,     "Communication Number"),
                        b::Element(e::NotUsed,     "Communication Number Qualifier"),
                        b::Element(e::NotUsed,     "Communication Number"),
                        b::Element(e::NotUsed,     "Contact Inquiry Reference"))))),

                d::LoopDef.build("2700 - ADDITIONAL REPORTING CATEGORIES", d::RepeatCount.bounded(1),
                  b::Segment(6880, s::LS, "Additional Reporting Categories", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Loop Identifier Code", b::Values("2700"))),

                  d::LoopDef.build("2710 - MEMBER REPORTING CATEGORIES", d::RepeatCount.unbounded,
                    b::Segment(6881, s::LX, "Member Reporting Categories", r::Situational, d::RepeatCount.bounded(1),
                      b::Element(e::Required,    "Assigned Number")),

                    d::LoopDef.build("2750 - REPORTING CATEGORY", d::RepeatCount.bounded(1),
                      b::Segment(6882, s::N1, "Reporting Category", r::Situational, d::RepeatCount.bounded(1),
                        b::Element(e::Required,    "Entity Identifier Code", b::Values("75")),
                        b::Element(e::Required,    "Member Reporting Category Name", b::MaxLength(60)),
                        b::Element(e::NotUsed,     "Identification Code Qualifier"),
                        b::Element(e::NotUsed,     "Identification Code"),
                        b::Element(e::NotUsed,     "Entity Relationship Code"),
                        b::Element(e::NotUsed,     "Entity Identifier Code")),
                      b::Segment(6883, s::REF, "Reporting Category Reference", r::Situational, d::RepeatCount.bounded(16),
                        b::Element(e::Required,    "Reference Identification Qualifier", b::Values("00", "17", "18", "19", "26", "3L", "6M", "9V", "9X", "GE", "LU", "PID", "XX1", "XX2", "YY", "ZZ")),
                        b::Element(e::Required,    "Member Reporting Category Reference ID", b::MaxLength(50)),
                        b::Element(e::NotUsed,     "Description"),
                        b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
                      b::Segment(6884, s::DTP, "Reporting Category Date", r::Situational, d::RepeatCount.bounded(1),
                        b::Element(e::Required,    "Date Time Qualifier", b::Values("007")),
                        b::Element(e::Required,    "Date Time Period Format Qualifier", b::Values("D8", "RD8")),
                        b::Element(e::Required,    "Member Reporting Category Effective Date(s)", b::MaxLength(35))))),
                  b::Segment(6885, s::LE, "Additional Reporting Categories Loop Termination", r::Situational, d::RepeatCount.bounded(1),
                    b::Element(e::Required,    "Loop Identifier Code", b::Values("2700")))))),

            # This structure doesn't match the specification, but it does ensure
            # that the first occurrence of SE terminates the transaction set.
            d::TableDef.summary("3 - Summary",
              b::Segment(6900, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
                b::Element(e::Required,    "Transaction Segment Count"),
                b::Element(e::Required,    "Transaction Set Control Number"))))

        end
      end
    end
  end
end
