from enum import Enum


class LineType(Enum):
    BLANK = 0
    BLUE = 1
    RED = 2
    WHITE1 = 3
    WHITE2 = 4
    COPYRIGHT1 = 5
    COPYRIGHT2 = 6
    COPYRIGHT3 = 7
    COPYRIGHT4 = 8
    END = 9


LINE_TYPE_VALS = {
    LineType.BLANK: 0x5,
    LineType.BLUE: 0x0,
    LineType.RED: 0x1,
    LineType.WHITE1: 0x3,
    LineType.WHITE2: 0x2,
    LineType.COPYRIGHT1: 0xA,
    LineType.COPYRIGHT2: 0xB,
    LineType.COPYRIGHT3: 0xC,
    LineType.COPYRIGHT4: 0xD,
    LineType.END: 0x6,
}

LINE_TYPE_HEIGHTS = {
    LineType.BLANK: 1,
    LineType.BLUE: 1,
    LineType.RED: 1,
    LineType.WHITE1: 1,
    LineType.WHITE2: 2,
    LineType.COPYRIGHT1: 1,
    LineType.COPYRIGHT2: 1,
    LineType.COPYRIGHT3: 1,
    LineType.COPYRIGHT4: 1,
    LineType.END: 0,
}

TEXT_LINE_TYPES = {LineType.BLUE, LineType.RED, LineType.WHITE1, LineType.WHITE2}

MARS_CREDITS = [
    (LineType.WHITE2, 4, "MARS Development"),
    (LineType.BLUE, 2, "PROGRAMMING"),
    (LineType.WHITE2, 1, "AntyMew"),
    (LineType.WHITE2, 1, "biospark"),
    (LineType.WHITE2, 1, "cluekitty"),
    (LineType.WHITE2, 1, "Zarakava"),
    (LineType.WHITE2, 1, "Miepee"),
    (LineType.WHITE2, 1, "JeffGainsNGames"),
    (LineType.WHITE2, 3, "duncathan_salt"),
    (LineType.BLUE, 2, "GRAPHICS"),
    (LineType.WHITE2, 1, "jakoliath"),
    (LineType.WHITE2, 1, "AbyssalCreature"),
    (LineType.WHITE2, 1, "bariasu"),
    (LineType.WHITE2, 3, "Raddley Vance"),
    (LineType.BLUE, 2, "MUSIC"),
    (LineType.WHITE2, 3, "JRP"),
    (LineType.BLUE, 2, "SPECIAL THANKS TO"),
    (LineType.WHITE2, 1, "Yohann"),
    (LineType.WHITE2, 2, "Kazuto"),
    (LineType.WHITE2, 2, "And contributions from others"),
]

RDV_CREDITS = [
    (LineType.WHITE2, 4, "Randovania"),
    (LineType.BLUE, 2, "Integration"),
    (LineType.WHITE2, 1, "JeffGainsNGames"),
    (LineType.WHITE2, 1, "Miepee"),
    (LineType.WHITE2, 1, "m4rkersm4sk"),
    (LineType.WHITE2, 3, "cluekitty"),
    (LineType.BLUE, 2, "LOGIC DATABASE"),
    (LineType.WHITE2, 1, "cluekitty"),
    (LineType.WHITE2, 1, "HerculesBenchPress"),
    (LineType.WHITE2, 1, "HyperBola"),
    (LineType.WHITE2, 1, "JaggerG"),
    (LineType.WHITE2, 1, "JeffGainsNGames"),
    (LineType.WHITE2, 1, "Schwartz Ghandi"),
    (LineType.WHITE2, 1, "m4rkersm4sk"),
    (LineType.WHITE2, 1, "Miepee"),
    (LineType.WHITE2, 3, "Sharky"),
]

# Shortened from 462 lines to 308 lines
FUSION_STAFF_LINES = [
    (LineType.WHITE2, 4, "ORIGINAL FUSION STAFF"),
    (LineType.BLUE, 1, "PRODUCER"),
    (LineType.WHITE1, 5, "Izushi Takehiro"),
    (LineType.BLUE, 1, "CHIEF DIRECTOR"),
    (LineType.WHITE1, 5, "Sakamoto Yoshio"),
    (LineType.BLUE, 1, "SYSTEM DIRECTOR"),
    (LineType.WHITE1, 3, "Hosokawa Takehiko"),
    (LineType.BLUE, 1, "SCENARIO & STORY"),
    (LineType.WHITE1, 3, "Sakamoto Yoshio"),
    (LineType.BLUE, 1, "GAME DESIGN"),
    (LineType.WHITE1, 1, "Yamane Tomoyoshi"),
    (LineType.WHITE1, 3, "Hosokawa Takehiko"),
    (LineType.BLUE, 1, "COURSE DESIGN"),
    (LineType.WHITE1, 1, "Ueda Masani"),
    (LineType.WHITE1, 3, "Nakada Ryuichi"),
    (LineType.BLUE, 1, "VISUAL DIRECTOR"),
    (LineType.WHITE1, 3, "Yamane Tomoyoshi"),
    (LineType.BLUE, 1, "SAMUS DESIGN"),
    (LineType.WHITE1, 3, "Sano Shinya"),
    (LineType.BLUE, 1, "SAMUS ORIGINAL DESIGN"),
    (LineType.WHITE1, 3, "Kiyotake Hiroji"),
    (LineType.BLUE, 1, "ENEMY CHARACTER DESIGN"),
    (LineType.WHITE1, 1, "Yamane Tomoyoshi"),
    (LineType.WHITE1, 1, "Hirano Isao"),
    (LineType.WHITE1, 1, "Sano Shinya"),
    (LineType.WHITE1, 3, "Matsushita Tadashi"),
    (LineType.BLUE, 1, "BACKGROUND GRAPHIC DESIGN"),
    (LineType.WHITE1, 1, "Morisawa Takayasu"),
    (LineType.WHITE1, 3, "Miyamoto Fumiko"),
    (LineType.BLUE, 1, "GRAPHIC DESIGN"),
    (LineType.WHITE1, 1, "Momose Hiroshi"),
    (LineType.WHITE1, 3, "Sakiyama Chiharu"),
    (LineType.BLUE, 1, "PROGRAM DIRECTOR"),
    (LineType.WHITE1, 3, "Yamano Katsuya"),
    (LineType.BLUE, 1, "SAMUS PROGRAMMING"),
    (LineType.WHITE1, 3, "Katsuki Yoshinori"),
    (LineType.BLUE, 1, "ENEMY CHARACTER PROGRAMMING"),
    (LineType.WHITE1, 3, "Yamano Katsuya"),
    (LineType.BLUE, 1, "SYSTEM PROGRAMMING"),
    (LineType.WHITE1, 3, "Ozaki Nobuhiro"),
    (LineType.BLUE, 1, "CINEMA SCENE PROGRAMMING"),
    (LineType.WHITE1, 3, "Nakae Eisaku"),
    (LineType.BLUE, 1, "TOOL PROGRAMMING"),
    (LineType.WHITE1, 1, "Harada Takahiro"),
    (LineType.WHITE1, 1, "Fukui Kota"),
    (LineType.WHITE1, 1, "Katsuki Yoshinori"),
    (LineType.WHITE1, 1, "Ozaki Nobuhiro"),
    (LineType.WHITE1, 3, "Momose Hiroshi"),
    (LineType.BLUE, 1, "SOUND DIRECTOR"),
    (LineType.WHITE1, 3, "Yamamoto Kenji"),
    (LineType.BLUE, 1, "MUSIC COMPOSITION"),
    (LineType.WHITE1, 1, "Hamano Minako"),
    (LineType.WHITE1, 3, "Fujiwara Akira"),
    (LineType.BLUE, 1, "SOUND EFFECTS & PROGRAMMING"),
    (LineType.WHITE1, 3, "Fujii Takaya"),
    (LineType.BLUE, 1, "PACKAGE DESIGN"),
    (LineType.WHITE1, 3, "Nakamichi Sachiko"),
    (LineType.BLUE, 1, "MANUAL DESIGN"),
    (LineType.WHITE1, 1, "Nakamichi Sachiko"),
    (LineType.WHITE1, 1, "Itani Kiyomi"),
    (LineType.WHITE1, 3, "Takahashi Yasuko"),
    (LineType.BLUE, 1, "COORDINATION"),
    (LineType.WHITE1, 3, "Harada Takahiro"),
    (LineType.BLUE, 1, "INTERNATIONAL COORDINATION"),
    (LineType.WHITE1, 3, "Yamazaki Sakae"),
    (LineType.BLUE, 1, "DEBUG"),
    (LineType.WHITE1, 6, "SUPER MARIO CLUB"),
    (LineType.BLUE, 1, "SPECIAL THANKS"),
    (LineType.WHITE1, 10, "Matsumura Satoshi"),
    (LineType.RED, 2, "NOA ENGLISH LOCALIZATION"),
    (LineType.BLUE, 1, "LOCALIZATION MANAGEMENT"),
    (LineType.WHITE1, 1, "Jeff Miller"),
    (LineType.WHITE1, 3, "Leslie Swan"),
    (LineType.BLUE, 1, "LOCALIZATION"),
    (LineType.WHITE1, 1, "Scot Ritchey"),
    (LineType.WHITE1, 1, "Nathan Bihldorff"),
    (LineType.WHITE1, 3, "Tim O-Leary"),
    (LineType.BLUE, 1, "ENGINEERING DEBUG"),
    (LineType.WHITE1, 1, "Raychole L'Anett"),
    (LineType.WHITE1, 1, "Robert Crombie"),
    (LineType.WHITE1, 1, "Kirk Buchanan"),
    (LineType.WHITE1, 2, "Yoshinobu Mantani"),
    (LineType.WHITE1, 1, "Scott Callahan"),
    (LineType.WHITE1, 1, "Don Dillinger"),
    (LineType.WHITE1, 3, "Hisako Sakauchi"),
    (LineType.BLUE, 1, "SPECIAL THANKS"),
    (LineType.WHITE1, 1, "Tatsumi Kimishima"),
    (LineType.WHITE1, 1, "Mike Fukuda"),
    (LineType.WHITE1, 13, "Hiroshi Kamada"),
    (LineType.BLUE, 1, "EXECUTIVE PRODUCER"),
    (LineType.WHITE1, 22, "Iwata Satoru"),
    (LineType.COPYRIGHT1, 0, None),
    (LineType.COPYRIGHT2, 0, None),
    (LineType.COPYRIGHT3, 0, None),
    (LineType.COPYRIGHT4, 9, None),
    (LineType.END, 0, None),
]
