# Manual coding of the 383 Draghi measures.
#
# CODING RULE (applied to the OBJECT of the measure, not to its difficulty
# or its legislative instrument):
#
#   C = CAPACITY.    The thing the measure secures already exists somewhere
#                    and can be obtained by transaction: purchased, contracted,
#                    stockpiled, funded, permitted, taxed, tariffed, mandated,
#                    monitored or legislated. Delivery is an act of acquisition,
#                    allocation or authorisation inside a budget cycle.
#
#   K = CAPABILITY.  The thing the measure secures must be accumulated:
#                    know-how, skills base, engineering experience, R&D depth,
#                    industrial ecosystem, firm-level technological mastery.
#                    No transaction produces it; repeated practice over years does.
#
#   I = INSTITUTIONAL. The object is neither purchasable nor accumulated
#                    technical know-how: it is a transfer of authority, a change
#                    in market structure, or the surrender of a national
#                    prerogative. Included as a separate code so that the
#                    C-vs-K test is not contaminated by "politically hard".

CAPABILITY = {
    63, 76, 78, 79,                                    # Energy
    123, 124, 125,                                     # CRM
    157, 165, 166, 174, 177, 178, 179, 180, 181, 182,
    184, 185, 186, 187,                                # Digital
    229,                                               # EII
    233, 239, 252, 257, 258, 259, 261, 262, 266,       # Clean tech
    272, 281, 287, 288, 289,                           # Automotive
    300,                                               # Defence
    321, 323,                                          # Space
    327, 338,                                          # Pharma
    362, 363, 364, 365, 366, 375, 382,                 # Transport
}

INSTITUTIONAL = {
    12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 34, 39, 43, 49, 51, 53,
    58, 69, 71, 73, 80, 81, 82, 83,                    # Energy
    95, 115,                                           # CRM
    141, 142, 143, 144, 145, 146, 154, 170, 172,       # Digital
    190, 222,                                          # EII
    248,                                               # Clean tech
    299, 301, 303, 304,                                # Defence
    307, 308, 309, 310, 311, 312, 315, 322,            # Space
    330, 333, 337,                                     # Pharma
    343, 344, 345, 352, 353, 354, 355,                 # Transport
}


def code(mid):
    if mid in CAPABILITY:
        return "K"
    if mid in INSTITUTIONAL:
        return "I"
    return "C"
