{-# LANGUAGE OverloadedStrings, DeriveGeneric #-}

module Episodes
    ( episodes
    , Episode
    ) where

import Data.Text as T
import Data.Aeson
import Data.Time.Clock
import Data.Time.Format
import System.Locale
import GHC.Generics

data Episode = Episode
    { no     :: Int
    , code   :: T.Text
    , prodNo :: Int
    , date   :: UTCTime
    , title  :: T.Text
    } deriving Generic

d :: String -> UTCTime
d = readTime defaultTimeLocale "%d/%b/%y"

instance ToJSON Episode

episodes :: [Episode]
episodes =
  [ Episode 1     "1-01"     101      (d "28/Sep/87") "Encounter at Farpoint, Part I"
  , Episode 2     "1-02"     102      (d "28/Sep/87") "Encounter at Farpoint, Part II"
  , Episode 3     "1-03"     103      (d "05/Oct/87") "The Naked Now"
  , Episode 4     "1-04"     104      (d "12/Oct/87") "Code of Honor"
  , Episode 5     "1-05"     107      (d "19/Oct/87") "The Last Outpost"
  , Episode 6     "1-06"     106      (d "26/Oct/87") "Where No One Has Gone Before"
  , Episode 7     "1-07"     108      (d "02/Nov/87") "Lonely Among Us"
  , Episode 8     "1-08"     109      (d "09/Nov/87") "Justice"
  , Episode 9     "1-09"     110      (d "16/Nov/87") "The Battle"
  , Episode 10    "1-10"     111      (d "23/Nov/87") "Hide and Q"
  , Episode 11    "1-11"     105      (d "30/Nov/87") "Haven"
  , Episode 12    "1-12"     113      (d "11/Jan/88") "The Big Goodbye"
  , Episode 13    "1-13"     114      (d "18/Jan/88") "Datalore"
  , Episode 14    "1-14"     115      (d "25/Jan/88") "Angel One"
  , Episode 15    "1-15"     116      (d "01/Feb/88") "11001001"
  , Episode 16    "1-16"     112      (d "08/Feb/88") "Too Short a Season"
  , Episode 17    "1-17"     118      (d "15/Feb/88") "When the Bough Breaks"
  , Episode 18    "1-18"     117      (d "22/Feb/88") "Home Soil"
  , Episode 19    "1-19"     119      (d "14/Mar/88") "Coming of Age"
  , Episode 20    "1-20"     120      (d "21/Mar/88") "Heart of Glory"
  , Episode 21    "1-21"     121      (d "11/Apr/88") "The Arsenal of Freedom"
  , Episode 22    "1-22"     123      (d "18/Apr/88") "Symbiosis"
  , Episode 23    "1-23"     122      (d "25/Apr/88") "Skin of Evil"
  , Episode 24    "1-24"     124      (d "02/May/88") "We'll Always Have Paris"
  , Episode 25    "1-25"     125      (d "09/May/88") "Conspiracy"
  , Episode 26    "1-26"     126      (d "16/May/88") "The Neutral Zone"
  , Episode 27    "2-01"     127      (d "21/Nov/88") "The Child"
  , Episode 28    "2-02"     128      (d "28/Nov/88") "Where Silence Has Lease"
  , Episode 29    "2-03"     129      (d "05/Dec/88") "Elementary, Dear Data"
  , Episode 30    "2-04"     130      (d "12/Dec/88") "The Outrageous Okona"
  , Episode 31    "2-05"     132      (d "09/Jan/89") "Loud as a Whisper"
  , Episode 32    "2-06"     131      (d "23/Jan/89") "The Schizoid Man"
  , Episode 33    "2-07"     133      (d "30/Jan/89") "Unnatural Selection"
  , Episode 34    "2-08"     134      (d "06/Feb/89") "A Matter of Honor"
  , Episode 35    "2-09"     135      (d "13/Feb/89") "The Measure of a Man"
  , Episode 36    "2-10"     136      (d "20/Feb/89") "The Dauphin"
  , Episode 37    "2-11"     137      (d "20/Mar/89") "Contagion"
  , Episode 38    "2-12"     138      (d "27/Mar/89") "The Royale"
  , Episode 39    "2-13"     139      (d "03/Apr/89") "Time Squared"
  , Episode 40    "2-14"     140      (d "24/Apr/89") "The Icarus Factor"
  , Episode 41    "2-15"     141      (d "01/May/89") "Pen Pals"
  , Episode 42    "2-16"     142      (d "08/May/89") "Q Who?"
  , Episode 43    "2-17"     143      (d "15/May/89") "Samaritan Snare"
  , Episode 44    "2-18"     144      (d "22/May/89") "Up the Long Ladder"
  , Episode 45    "2-19"     145      (d "19/Jun/89") "Manhunt"
  , Episode 46    "2-20"     146      (d "29/Jun/89") "The Emissary"
  , Episode 47    "2-21"     147      (d "10/Jul/89") "Peak Performance"
  , Episode 48    "2-22"     148      (d "17/Jul/89") "Shades of Gray"
  , Episode 49    "3-01"     150      (d "25/Sep/89") "Evolution"
  , Episode 50    "3-02"     149      (d "02/Oct/89") "The Ensigns of Command"
  , Episode 51    "3-03"     151      (d "09/Oct/89") "The Survivors"
  , Episode 52    "3-04"     152      (d "16/Oct/89") "Who Watches the Watchers?"
  , Episode 53    "3-05"     153      (d "23/Oct/89") "The Bonding"
  , Episode 54    "3-06"     154      (d "30/Oct/89") "Booby Trap"
  , Episode 55    "3-07"     155      (d "06/Nov/89") "The Enemy"
  , Episode 56    "3-08"     156      (d "13/Nov/89") "The Price"
  , Episode 57    "3-09"     157      (d "20/Nov/89") "The Vengeance Factor"
  , Episode 58    "3-10"     158      (d "01/Jan/90") "The Defector"
  , Episode 59    "3-11"     159      (d "08/Jan/90") "The Hunted"
  , Episode 60    "3-12"     160      (d "29/Jan/90") "The High Ground"
  , Episode 61    "3-13"     161      (d "05/Feb/90") "Déjà Q"
  , Episode 62    "3-14"     162      (d "12/Feb/90") "A Matter of Perspective"
  , Episode 63    "3-15"     163      (d "19/Feb/90") "Yesterday's Enterprise"
  , Episode 64    "3-16"     164      (d "12/Mar/90") "The Offspring"
  , Episode 65    "3-17"     165      (d "19/Mar/90") "Sins of the Father"
  , Episode 66    "3-18"     166      (d "26/Mar/90") "Allegiance"
  , Episode 67    "3-19"     167      (d "02/Apr/90") "Captain's Holiday"
  , Episode 68    "3-20"     168      (d "23/Apr/90") "Tin Man"
  , Episode 69    "3-21"     169      (d "30/Apr/90") "Hollow Pursuits"
  , Episode 70    "3-22"     170      (d "07/May/90") "The Most Toys"
  , Episode 71    "3-23"     171      (d "14/May/90") "Sarek"
  , Episode 72    "3-24"     172      (d "28/May/90") "Ménage à Troi"
  , Episode 73    "3-25"     173      (d "04/Jun/90") "Transfigurations"
  , Episode 74    "3-26"     174      (d "18/Jun/90") "The Best of Both Worlds (1)"
  , Episode 75    "4-01"     175      (d "24/Sep/90") "The Best of Both Worlds, Part II"
  , Episode 76    "4-02"     178      (d "01/Oct/90") "Family"
  , Episode 77    "4-03"     177      (d "08/Oct/90") "Brothers"
  , Episode 78    "4-04"     176      (d "15/Oct/90") "Suddenly Human"
  , Episode 79    "4-05"     179      (d "22/Oct/90") "Remember Me"
  , Episode 80    "4-06"     180      (d "29/Oct/90") "Legacy"
  , Episode 81    "4-07"     181      (d "05/Nov/90") "Reunion"
  , Episode 82    "4-08"     182      (d "12/Nov/90") "Future Imperfect"
  , Episode 83    "4-09"     183      (d "19/Nov/90") "Final Mission"
  , Episode 84    "4-10"     184      (d "31/Dec/90") "The Loss"
  , Episode 85    "4-11"     185      (d "07/Jan/91") "Data's Day"
  , Episode 86    "4-12"     186      (d "28/Jan/91") "The Wounded"
  , Episode 87    "4-13"     187      (d "04/Feb/91") "Devil's Due"
  , Episode 88    "4-14"     188      (d "11/Feb/91") "Clues"
  , Episode 89    "4-15"     189      (d "18/Feb/91") "First Contact"
  , Episode 90    "4-16"     190      (d "11/Mar/91") "Galaxy's Child"
  , Episode 91    "4-17"     191      (d "18/Mar/91") "Night Terrors"
  , Episode 92    "4-18"     192      (d "25/Mar/91") "Identity Crisis"
  , Episode 93    "4-19"     193      (d "01/Apr/91") "The Nth Degree"
  , Episode 94    "4-20"     194      (d "22/Apr/91") "Qpid"
  , Episode 95    "4-21"     195      (d "29/Apr/91") "The Drumhead"
  , Episode 96    "4-22"     196      (d "06/May/91") "Half a Life"
  , Episode 97    "4-23"     198      (d "13/May/91") "The Host"
  , Episode 98    "4-24"     198      (d "27/May/91") "The Mind's Eye"
  , Episode 99    "4-25"     199      (d "03/Jun/91") "In Theory"
  , Episode 100   "4-26"     200      (d "17/Jun/91") "Redemption, Part I"
  , Episode 101   "5-01"     201      (d "23/Sep/91") "Redemption, Part II"
  , Episode 102   "5-02"     202      (d "30/Sep/91") "Darmok"
  , Episode 103   "5-03"     203      (d "07/Oct/91") "Ensign Ro"
  , Episode 104   "5-04"     204      (d "14/Oct/91") "Silicon Avatar"
  , Episode 105   "5-05"     205      (d "21/Oct/91") "Disaster"
  , Episode 106   "5-06"     206      (d "28/Oct/91") "The Game"
  , Episode 107   "5-07"     208      (d "04/Nov/91") "Unification, Part I"
  , Episode 108   "5-08"     207      (d "11/Nov/91") "Unification, Part II"
  , Episode 109   "5-09"     209      (d "18/Nov/91") "A Matter of Time"
  , Episode 110   "5-10"     210      (d "06/Jan/92") "New Ground"
  , Episode 111   "5-11"     211      (d "27/Jan/92") "Hero Worship"
  , Episode 112   "5-12"     212      (d "03/Feb/92") "Violations"
  , Episode 113   "5-13"     213      (d "10/Feb/92") "The Masterpiece Society"
  , Episode 114   "5-14"     215      (d "17/Feb/92") "Conundrum"
  , Episode 115   "5-15"     215      (d "24/Feb/92") "Power Play"
  , Episode 116   "5-16"     216      (d "02/Mar/92") "Ethics"
  , Episode 117   "5-17"     217      (d "16/Mar/92") "The Outcast"
  , Episode 118   "5-18"     218      (d "23/Mar/92") "Cause and Effect"
  , Episode 119   "5-19"     219      (d "30/Mar/92") "The First Duty"
  , Episode 120   "5-20"     220      (d "20/Apr/92") "Cost of Living"
  , Episode 121   "5-21"     221      (d "27/Apr/92") "The Perfect Mate"
  , Episode 122   "5-22"     222      (d "04/May/92") "Imaginary Friend"
  , Episode 123   "5-23"     223      (d "11/May/92") "I, Borg"
  , Episode 124   "5-24"     224      (d "18/May/92") "The Next Phase"
  , Episode 125   "5-25"     225      (d "01/Jun/92") "The Inner Light"
  , Episode 126   "5-26"     226      (d "15/Jun/92") "Time's Arrow, Part I"
  , Episode 127   "6-01"     227      (d "21/Sep/92") "Time's Arrow, Part II"
  , Episode 128   "6-02"     228      (d "28/Sep/92") "Realm of Fear"
  , Episode 129   "6-03"     229      (d "05/Oct/92") "Man of the People"
  , Episode 130   "6-04"     230      (d "12/Oct/92") "Relics"
  , Episode 131   "6-05"     231      (d "19/Oct/92") "Schisms"
  , Episode 132   "6-06"     232      (d "26/Oct/92") "True Q"
  , Episode 133   "6-07"     233      (d "02/Nov/92") "Rascals"
  , Episode 134   "6-08"     234      (d "09/Nov/92") "A Fistful of Datas"
  , Episode 135   "6-09"     235      (d "16/Nov/92") "The Quality of Life"
  , Episode 136   "6-10"     236      (d "14/Dec/92") "Chain of Command, Part I"
  , Episode 137   "6-11"     237      (d "21/Dec/92") "Chain of Command, Part II"
  , Episode 138   "6-12"     238      (d "25/Jan/93") "Ship in a Bottle"
  , Episode 139   "6-13"     239      (d "01/Feb/93") "Aquiel"
  , Episode 140   "6-14"     240      (d "08/Feb/93") "Face Of The Enemy"
  , Episode 141   "6-15"     241      (d "15/Feb/93") "Tapestry"
  , Episode 142   "6-16"     242      (d "22/Feb/93") "Birthright, Part I"
  , Episode 143   "6-17"     243      (d "01/Mar/93") "Birthright, Part II"
  , Episode 144   "6-18"     244      (d "29/Mar/93") "Starship Mine"
  , Episode 145   "6-19"     245      (d "05/Apr/93") "Lessons"
  , Episode 146   "6-20"     246      (d "26/Apr/93") "The Chase"
  , Episode 147   "6-21"     247      (d "03/May/93") "Frame of Mind"
  , Episode 148   "6-22"     248      (d "10/May/93") "Suspicions"
  , Episode 149   "6-23"     249      (d "17/May/93") "Rightful Heir"
  , Episode 150   "6-24"     250      (d "24/May/93") "Second Chances"
  , Episode 151   "6-25"     251      (d "14/Jun/93") "Timescape"
  , Episode 152   "6-26"     252      (d "21/Jun/93") "Descent, Part I"
  , Episode 153   "7-01"     253      (d "20/Sep/93") "Descent, Part II"
  , Episode 154   "7-02"     254      (d "27/Sep/93") "Liaisons"
  , Episode 155   "7-03"     255      (d "04/Oct/93") "Interface"
  , Episode 156   "7-04"     256      (d "11/Oct/93") "Gambit, Part I"
  , Episode 157   "7-05"     257      (d "18/Oct/93") "Gambit, Part II"
  , Episode 158   "7-06"     258      (d "25/Oct/93") "Phantasms"
  , Episode 159   "7-07"     259      (d "01/Nov/93") "Dark Page"
  , Episode 160   "7-08"     260      (d "08/Nov/93") "Attached"
  , Episode 161   "7-09"     261      (d "15/Nov/93") "Force of Nature"
  , Episode 162   "7-10"     262      (d "22/Nov/93") "Inheritance"
  , Episode 163   "7-11"     263      (d "29/Nov/93") "Parallels"
  , Episode 164   "7-12"     264      (d "10/Jan/94") "The Pegasus"
  , Episode 165   "7-13"     265      (d "17/Jan/94") "Homeward"
  , Episode 166   "7-14"     266      (d "31/Jan/94") "Sub Rosa"
  , Episode 167   "7-15"     267      (d "07/Feb/94") "Lower Decks"
  , Episode 168   "7-16"     268      (d "14/Feb/94") "Thine Own Self"
  , Episode 169   "7-17"     269      (d "21/Feb/94") "Masks"
  , Episode 170   "7-18"     270      (d "28/Feb/94") "Eye of the Beholder"
  , Episode 171   "7-19"     271      (d "21/Mar/94") "Genesis"
  , Episode 172   "7-20"     272      (d "28/Mar/94") "Journey's End"
  , Episode 173   "7-21"     273      (d "25/Apr/94") "Firstborn"
  , Episode 174   "7-22"     274      (d "02/May/94") "Bloodlines"
  , Episode 175   "7-23"     275      (d "09/May/94") "Emergence"
  , Episode 176   "7-24"     276      (d "16/May/94") "Preemptive Strike"
  , Episode 177   "7-25"     277      (d "23/May/94") "All Good Things... (1)"
  , Episode 178   "7-26"     278      (d "23/May/94") "All Good Things... (2)"
  ]
