+instance XmlImportFk WeatherForecastXml
+
+-- * WeatherDetailedWeatherXml
+
+-- | XML Representation of a \<Detailed_Weather\>, which just contains
+-- a bunch iof \<DW_Listing\>s. There is no associated database type
+-- since these don't really contain any information.
+--
+data WeatherDetailedWeatherXml =
+ WeatherDetailedWeatherXml {
+ xml_detailed_listings :: [WeatherDetailedWeatherListingXml] }
+ deriving (Eq, Show)
+
+
+-- * WeatherDetailedWeatherXml
+
+-- | XML Representation of a \<DW_Listing\>. The sport and sport code
+-- come as attributes, but then these just contain a bunch of
+-- \<Item\>s. There is no associated database type since these don't
+-- contain much information. The sport we already know from the
+-- \<message\>, while the sport code is ignored since it's already
+-- present in each \<Item\>s.
+--
+data WeatherDetailedWeatherListingXml =
+ WeatherDetailedWeatherListingXml {
+ xml_dtl_listing_sport :: String,
+ xml_dtl_listing_sport_code :: String,
+ xml_items :: [WeatherDetailedWeatherListingItemXml] }
+ deriving (Eq, Show)
+
+-- * WeatherDetailedWeatherListingItem / WeatherDetailedWeatherListingItemXml
+
+-- | Database representation of a detailed weather item. The away/home
+-- teams don't use the representation in "TSN.Team" because all
+-- we're given is a name, and a team id is required for "TSN.Team".
+--
+-- We also drop the sport name, because it's given in the parent
+-- 'Weather'.
+--
+data WeatherDetailedWeatherListingItem =
+ WeatherDetailedWeatherListingItem {
+ db_dtl_weather_id :: DefaultKey Weather, -- ^ Avoid name collision by
+ -- using \"dtl\" prefix.
+ db_sport_code :: String,
+ db_game_id :: Int,
+ db_dtl_game_date :: UTCTime, -- ^ Avoid name clash with \"dtl\" prefix
+ db_away_team :: String,
+ db_home_team :: String,
+ db_weather_type :: Int,
+ db_description :: String,
+ db_temp_adjust :: String,
+ db_temperature :: Int }
+
+
+-- | XML representation of a detailed weather item. Same as the
+-- database representation, only without the foreign key and the
+-- sport name that comes from the containing listing.
+data WeatherDetailedWeatherListingItemXml =
+ WeatherDetailedWeatherListingItemXml {
+ xml_sport_code :: String,
+ xml_game_id :: Int,
+ xml_dtl_game_date :: UTCTime,
+ xml_away_team :: String,
+ xml_home_team :: String,
+ xml_weather_type :: Int,
+ xml_description :: String,
+ xml_temp_adjust :: String,
+ xml_temperature :: Int }
+ deriving (Eq, Show)