from faker import Faker
from faker.providers import BaseProvider

_classrooms = [
    "A402",
    "AB101",
    "BI311",
    "C102",
    "CM631",
    "CS100",
    "CS335",
    "CSPC2",
    "CY201",
    "EA101",
    "EA106",
    "EAB06",
    "EB107",
    "EB415",
    "EC015",
    "EC016",
    "EC022",
    "EC114",
    "EC330",
    "ED814",
    "EEB24",
    "EF104",
    "EF452",
    "EO103",
    "ES806",
    "EV402",
    "F106",
    "F216",
    "F322",
    "FB010",
    "HA101",
    "HA220",
    "HA302",
    "HAB1",
    "HAB19",
    "HC101",
    "HC615",
    "HK318",
    "L100",
    "M-b01",  # 管理一管地下室
    "M101",
    "MB1061",  # 管理二館
    "MB110",
    "SA014",
    "SA320",
    "SA321",
    "SB119",
    "SB522",
    "SC001",
    "SC258",
    "SC427",
    "圖B1",
    "電腦教室3",
]
_courses = [
    ("Characterization and Analysis of Polymer", "高分子定性與分析"),
    ("Socio-cultural history of France", "法國社會文化史"),
    ("Formal Languages and Theory of Computation", "正規語言與計算理論(英文授課)"),
    ("Modern China: Cross-strait relations Globalization", "當代中國：全球化下的兩岸關係"),
    ("Power Semiconductor Devices - Physics and Technology", "高功率半導體元件物理與技術"),
    ("Advanced Eletrocardiology", "進階心臟電氣學"),
    ("Self-Active I-Learning", "自主學習課程"),
    ("Advanced Chinese-English Translation and Writing ", "高級中英翻譯寫作"),
    ("Advanced English Competence Workshop", "進階英語能力評鑑"),
    ("Advanced Japanese(1)", "高級日文(一)"),
    ("Advanced Syntax", "進階句法學"),
    ("Advanced Translation", "高級翻譯"),
    ("Advanced Writing (1)", "高級寫作（一）"),
    ("American Literature(1)", "美國文學(一)"),
    ("Basic Theatre Acting Training", "基礎表演"),
    ("Communicative Skills Workshop (1)", "傳達技巧工作坊(一)"),
    ("Communicative Skills Workshop(3)", "傳達技巧工作坊(三)"),
    ("Elementary French(1)", "初級法文(一)"),
    ("Elementary Japanese(1)", "初級日文(一)"),
    ("Elementary Spanish (I)", "初級西班牙文（一）"),
    ("English Competence Workshop", "英語能力評鑑"),
    ("English Composition (1)", "英文作文（一）"),
    ("English Literature (1)", "英國文學（一）"),
    ("Formal Syntax", "句法學"),
    ("Freshman English (1):an Introductory Approach to Literature", "大一英文一:文學作品導讀"),
    ("Intermediate French(1)", "中級法文(一)"),
    ("Intermediate Japanese(1)", "中級日文(一)"),
    ("Intermediate Spanish (I)", "中級西班牙文（一）"),
    ("Introduction to Linguistics (I)", "語言學概論（一）"),
    ("Introduction to Sociolinguistics", "社會語言學導論"),
    ("Introduction to Western Literature (1)", "西洋文學概論（一）"),
    ("Mentor's Hours", "導師時間"),
    ("Phonetics and Phonology-Part I : Vowels, consonant", "語音音韻專題一：元音與輔音研究"),
    ("Phonetics/Phonology", "語音學/音韻學"),
    ("Phonology Seminar: Language Contact", "音韻專題:語言接觸現象"),
    ("Phonology Seminar: Phonological Structure and Speech Perception", "音韻專題：音韻結構與語音感知"),
    ("Physical Education", "大一體育"),
    ("Physical Education", "體育－排球甲"),
    ("Physical Education", "體育－棒球甲"),
    ("Physical Education", "體育－籃球甲A"),
    ("Physical Education", "體育－網球甲"),
    ("Physical Education", "體育－足球甲"),
    ("Science Fiction Short Story and Film", "科幻短篇小說與電影"),
    ("Selective Reading of Western Literature", "經典文學選讀"),
    ("Service Learning I", "服務學習(一)"),
    ("Structure of Taiwanese", "台語概論"),
    ("Structures of Chinese", "漢語語法"),
    ("Syntax/Semantics", "句法學/語意學"),
]

_departments = [
    # Some department may not have english name
    ("", "百川學士學位學程"),
    ("College of Electrical Engineering and Computer Science", "電機學院與資訊學院"),
    ("College of Electrical and Computer Engineering", "電機學院院級(學士班)"),
    ("College of Humanities and Social Science", "人文社會學院院本部"),
    ("College of Management", "管理學院院本部"),
    ("Department  of Photonics", "光電工程學系"),
    ("Department of Applied Chemistry", "應用化學系"),
    ("Department of Applied Mathematics", "應用數學系"),
    ("Department of Biological Science and Technology", "生物科技學系"),
    ("Department of Civil Engineering", "土木工程學系"),
    ("Department of Communication and Technology", "傳播與科技學系"),
    ("Department of Computer Science", "資訊工程學系"),
    ("Department of Electrical and Computer Engineering", "電機工程學系"),
    ("Department of Electro-Physics", "電子物理學系"),
    ("Department of Electronics Engineering", "電子工程學系"),
    ("Department of Foreign Languages and Literatures", "外國語文學系"),
    ("Department of Humanities and Social Sciences", "人文社會學系"),
    ("Department of Industrial Engineering and Management", "工業工程與管理學系"),
    ("Department of Information and Finance Management", "資訊管理與財務金融系"),
    ("Department of Management Science", "管理科學系"),
    ("Department of Materials Science and Engineering", "材料科學與工程學系"),
    ("Department of Mechanical Engineering", "機械工程學系"),
    ("Department of Transportation and Logistics Management", "運輸與物流管理學系"),
    ("EECS Undergraduate Honors Program", "電機資訊學士班"),
    ("Institute for Social Research and Cultural Studies", "社會與文化研究所"),
    ("Institute of Applied Arts", "應用藝術研究所"),
    ("Institute of Architecture", "建築研究所"),
    ("Institute of Communication Studies", "傳播研究所"),
    ("Institute of Education", "教育研究所"),
    ("Institute of Foreign Literatures and Linguistics", "外國語文學系外國文學與語言學碩士班"),
    ("Institute of Music", "音樂研究所"),
    ("Taichung First Senior High School", "台中一中科學班"),
    (
        "Undergraduate Degree Program of System Engineering and Technology",
        "系統工程與科技學士學位學程",
    ),
    ("Undergraduate Honors Program of Nano Science and Engineering", "奈米科學及工程學士學位學程"),
    ("Undergraduate honors Program of Interdisciplinary Science", "理學院科學學士學位學程"),
]
_teachers = [
    # teacher may not be a person.
    "Alain Brossat",
    "Carlos Gussenhoven",
    "人社系",
    "仲崇厚",
    "伍啟萌",
    "伍紹勳",
    "何震寰",
    "佘曉清",
    "余俊宏",
    "余啟哲",
    "余沛慈",
    "侯君昊",
    "侯拓宏",
    "俞蘋",
    "傅恆霖",
    "傅武雄",
    "儒森斯坦",
    "光電系",
    "冀泰石",
    "冉曉雯",
    "冉曉雯、李柏璁",
    "凌天",
    "凌天、何欣怡",
    "刁維光",
    "劉典謨",
    "劉啟明",
    "劉大和",
    "劉奕蘭",
    "劉學儒",
    "劉宗哲、物理實驗助教",
    "劉家豪",
    "劉建男",
    "劉建良",
    "劉志尉",
    "劉柏村",
    "劉紀蕙",
    "劉義強",
    "劉義強、程登湖、賴錦文",
    "劉耀先",
    "劉辰生",
    "包德樂",
    "千野由喜",
    "台中一中",
    "向倩儀",
    "吳介琮",
    "吳俊育",
    "吳光雄",
    "吳凱強",
    "吳宇晴",
    "吳宗信",
    "吳宗修、蕭傑諭、林貴璽",
    "吳建德",
    "吳彥谷",
    "吳思葦",
    "吳慈菁、洪億津",
    "吳慶昇",
    "吳文偉",
    "吳文榕",
    "吳昆峰",
    "吳昌鴻",
    "吳東昆",
    "吳東昆、高智飛、楊裕雄",
    "吳樸偉",
    "吳欣潔",
    "吳泰毅",
    "吳浩庠",
    "吳淑褓",
    "吳炳飛",
    "吳煒聲",
    "吳耀銓",
    "吳育松",
    "吳致盛",
    "吳舜華",
    "吳金典",
    "呂嘉維",
    "呂志鵬",
    "呂恭安",
    "周世傑",
    "周倩",
    "周子豪、魏世昕、賴冠榮",
    "周昭廷",
    "周武清",
    "周苡嘉",
    "唐震寰",
    "單信瑜",
    "土木系",
    "奈米學位學程",
    "姚銘忠",
    "姜睿明",
    "孟心飛",
    "孟慶宗",
    "孫之元",
    "孫家偉",
    "安勤之",
    "安惠榮",
    "宋開泰",
    "官大智",
    "尤禎祥、曲在雯",
    "尹慶中",
    "工管系",
    "巫佳煌",
    "巫慧萍",
    "帥宏翰",
    "平松弘嗣",
    "康明軒",
    "廖光文、蕭育源、黃兆祺",
    "廖光文、鄒協成、邱光裕、趙啟宏、趙瑞益、梁美智",
    "廖奕翰",
    "廖威彰",
    "廖志中",
]

_dep_code = [
    "AIG",
    "ART",
    "CCP",
    "CGE",
    "COM",
    "CST",
    "DAC",
    "DAM",
    "DBT",
    "DCE",
    "DCP",
    "DCT",
    "DCV",
    "DEE",
    "DEM",
    "DEO",
    "DEP",
    "DFL",
    "DFR",
    "DHS",
    "DIF",
    "DMA",
    "DME",
    "DMS",
    "DOA",
    "DOH",
    "DOM",
    "DOS",
    "DPN",
    "DPS",
    "DTM",
    "DWA",
    "ECE",
    "ECM",
    "ECS",
    "EDU",
    "GDP",
    "GEC",
    "GEE",
    "IAA",
    "IAC",
    "IAM",
    "IAP",
    "IAR",
    "IAS",
    "IAT",
    "IBA",
    "IBE",
    "IBI",
    "IBM",
    "IBN",
    "IBS",
    "IBT",
    "ICH",
    "ICN",
    "ICS",
    "ICT",
    "ICV",
    "IDS",
    "IEC",
    "IED",
    "IEE",
    "IEM",
    "IEO",
    "IEP",
    "IET",
    "IEV",
    "IHC",
    "IHP",
    "IIB",
    "IIE",
    "IIM",
    "ILC",
    "ILE",
    "ILP",
    "ILS",
    "IMA",
    "IME",
    "IMI",
    "IMO",
    "IMS",
    "IMU",
    "INA",
    "INE",
    "INT",
    "IOC",
    "IOE",
    "IOF",
    "IOG",
    "IOM",
    "IOP",
    "IOS",
    "IPO",
    "IPP",
    "IPS",
    "IPT",
    "ISC",
    "ISE",
    "ISR",
    "IST",
    "ITE",
    "ITL",
    "ITM",
    "ITS",
    "ITT",
    "MBA",
    "MIN",
    "OIA",
    "PCM",
    "PMU",
    "PYY",
    "ROB",
    "SET",
    "SEV",
    "THU",
    "UEE",
]


class NCTUFakeProvider(BaseProvider):
    def timeslot_exp(self):
        """ Expression of timeslots
        example: '2EF5G', '1A', '4GH'
        """
        num_slots = self.random_int(1, 2)
        weekdays = sorted(self.random_elements([1, 2, 3, 4, 5], num_slots, unique=True))
        slots = ["A", "B", "CD", "CDX", "EF", "GH", "IJK"]
        result = []
        for w in weekdays:
            slot = self.random_element(slots)
            result.append(f"{w}{slot}")
        return "".join(result)

    def classroom(self):
        return self.random_element(_classrooms)

    def course(self):
        return self.random_element(_courses)

    def department(self):
        return self.random_element(_departments)

    def permanent_id(self):
        code = self.random_element(_dep_code)
        num = self.random_int(1000, 9000, 5)
        return f"{code}{num}"

    def course_type(self):
        return self.random_element(["必修", "選修"])

    def teacher(self):
        return self.random_element(_teachers)


fakeNctu = Faker()
fakeNctu.add_provider(NCTUFakeProvider)
