module WikiMusic.SSR.Free.View
  ( artistListPage,
    View (..),
    errorPage,
    loginPage,
    genreListPage,
    artistDetailPage,
    genreDetailPage,
    songListPage,
    songDetailPage,
    artistCreatePage,
    genreCreatePage,
    songCreatePage,
  )
where

import Free.AlaCarte
import Relude
import Text.Blaze.Html
import WikiMusic.Interaction.Model.Artist
import WikiMusic.Interaction.Model.Genre
import WikiMusic.Interaction.Model.Song
import WikiMusic.SSR.Model.Api
import WikiMusic.SSR.Model.Env

type View :: Type -> Type
data View a
  = ArtistListPage Env UiMode Language Palette SortOrder GetArtistsQueryResponse (Html -> a)
  | ArtistDetailPage Env UiMode Language Palette GetArtistsQueryResponse (Html -> a)
  | ArtistCreatePage Env UiMode Language Palette (Html -> a)
  | GenreListPage Env UiMode Language Palette SortOrder GetGenresQueryResponse (Html -> a)
  | GenreDetailPage Env UiMode Language Palette GetGenresQueryResponse (Html -> a)
  | GenreCreatePage Env UiMode Language Palette (Html -> a)
  | SongListPage Env UiMode Language Palette SortOrder GetSongsQueryResponse (Html -> a)
  | SongDetailPage Env UiMode Language Palette SongAsciiSize GetSongsQueryResponse (Html -> a)
  | SongCreatePage Env UiMode Language Palette (Html -> a)
  | ErrorPage Env UiMode Language Palette Text (Html -> a)
  | LoginPage Env UiMode Language Palette (Html -> a)
  deriving ((forall a b. (a -> b) -> View a -> View b)
-> (forall a b. a -> View b -> View a) -> Functor View
forall a b. a -> View b -> View a
forall a b. (a -> b) -> View a -> View b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> View a -> View b
fmap :: forall a b. (a -> b) -> View a -> View b
$c<$ :: forall a b. a -> View b -> View a
<$ :: forall a b. a -> View b -> View a
Functor)

artistListPage :: (View :<: f) => Env -> UiMode -> Language -> Palette -> SortOrder -> GetArtistsQueryResponse -> Free f Html
artistListPage :: forall (f :: * -> *).
(View :<: f) =>
Env
-> UiMode
-> Language
-> Palette
-> SortOrder
-> GetArtistsQueryResponse
-> Free f Html
artistListPage Env
env UiMode
mode Language
language Palette
palette SortOrder
sortOrder GetArtistsQueryResponse
artists = View (Free f Html) -> Free f Html
forall (g :: * -> *) (f :: * -> *) a.
(g :<: f) =>
g (Free f a) -> Free f a
injectFree (Env
-> UiMode
-> Language
-> Palette
-> SortOrder
-> GetArtistsQueryResponse
-> (Html -> Free f Html)
-> View (Free f Html)
forall a.
Env
-> UiMode
-> Language
-> Palette
-> SortOrder
-> GetArtistsQueryResponse
-> (Html -> a)
-> View a
ArtistListPage Env
env UiMode
mode Language
language Palette
palette SortOrder
sortOrder GetArtistsQueryResponse
artists Html -> Free f Html
forall (f :: * -> *) a. a -> Free f a
Pure)

artistDetailPage :: (View :<: f) => Env -> UiMode -> Language -> Palette -> GetArtistsQueryResponse -> Free f Html
artistDetailPage :: forall (f :: * -> *).
(View :<: f) =>
Env
-> UiMode
-> Language
-> Palette
-> GetArtistsQueryResponse
-> Free f Html
artistDetailPage Env
env UiMode
mode Language
language Palette
palette GetArtistsQueryResponse
artists = View (Free f Html) -> Free f Html
forall (g :: * -> *) (f :: * -> *) a.
(g :<: f) =>
g (Free f a) -> Free f a
injectFree (Env
-> UiMode
-> Language
-> Palette
-> GetArtistsQueryResponse
-> (Html -> Free f Html)
-> View (Free f Html)
forall a.
Env
-> UiMode
-> Language
-> Palette
-> GetArtistsQueryResponse
-> (Html -> a)
-> View a
ArtistDetailPage Env
env UiMode
mode Language
language Palette
palette GetArtistsQueryResponse
artists Html -> Free f Html
forall (f :: * -> *) a. a -> Free f a
Pure)

artistCreatePage :: (View :<: f) => Env -> UiMode -> Language -> Palette -> Free f Html
artistCreatePage :: forall (f :: * -> *).
(View :<: f) =>
Env -> UiMode -> Language -> Palette -> Free f Html
artistCreatePage Env
env UiMode
mode Language
language Palette
palette = View (Free f Html) -> Free f Html
forall (g :: * -> *) (f :: * -> *) a.
(g :<: f) =>
g (Free f a) -> Free f a
injectFree (Env
-> UiMode
-> Language
-> Palette
-> (Html -> Free f Html)
-> View (Free f Html)
forall a.
Env -> UiMode -> Language -> Palette -> (Html -> a) -> View a
ArtistCreatePage Env
env UiMode
mode Language
language Palette
palette Html -> Free f Html
forall (f :: * -> *) a. a -> Free f a
Pure)

genreListPage :: (View :<: f) => Env -> UiMode -> Language -> Palette -> SortOrder -> GetGenresQueryResponse -> Free f Html
genreListPage :: forall (f :: * -> *).
(View :<: f) =>
Env
-> UiMode
-> Language
-> Palette
-> SortOrder
-> GetGenresQueryResponse
-> Free f Html
genreListPage Env
env UiMode
mode Language
language Palette
palette SortOrder
sortOrder GetGenresQueryResponse
genres = View (Free f Html) -> Free f Html
forall (g :: * -> *) (f :: * -> *) a.
(g :<: f) =>
g (Free f a) -> Free f a
injectFree (Env
-> UiMode
-> Language
-> Palette
-> SortOrder
-> GetGenresQueryResponse
-> (Html -> Free f Html)
-> View (Free f Html)
forall a.
Env
-> UiMode
-> Language
-> Palette
-> SortOrder
-> GetGenresQueryResponse
-> (Html -> a)
-> View a
GenreListPage Env
env UiMode
mode Language
language Palette
palette SortOrder
sortOrder GetGenresQueryResponse
genres Html -> Free f Html
forall (f :: * -> *) a. a -> Free f a
Pure)

genreDetailPage :: (View :<: f) => Env -> UiMode -> Language -> Palette -> GetGenresQueryResponse -> Free f Html
genreDetailPage :: forall (f :: * -> *).
(View :<: f) =>
Env
-> UiMode
-> Language
-> Palette
-> GetGenresQueryResponse
-> Free f Html
genreDetailPage Env
env UiMode
mode Language
language Palette
palette GetGenresQueryResponse
genres = View (Free f Html) -> Free f Html
forall (g :: * -> *) (f :: * -> *) a.
(g :<: f) =>
g (Free f a) -> Free f a
injectFree (Env
-> UiMode
-> Language
-> Palette
-> GetGenresQueryResponse
-> (Html -> Free f Html)
-> View (Free f Html)
forall a.
Env
-> UiMode
-> Language
-> Palette
-> GetGenresQueryResponse
-> (Html -> a)
-> View a
GenreDetailPage Env
env UiMode
mode Language
language Palette
palette GetGenresQueryResponse
genres Html -> Free f Html
forall (f :: * -> *) a. a -> Free f a
Pure)

genreCreatePage :: (View :<: f) => Env -> UiMode -> Language -> Palette -> Free f Html
genreCreatePage :: forall (f :: * -> *).
(View :<: f) =>
Env -> UiMode -> Language -> Palette -> Free f Html
genreCreatePage Env
env UiMode
mode Language
language Palette
palette = View (Free f Html) -> Free f Html
forall (g :: * -> *) (f :: * -> *) a.
(g :<: f) =>
g (Free f a) -> Free f a
injectFree (Env
-> UiMode
-> Language
-> Palette
-> (Html -> Free f Html)
-> View (Free f Html)
forall a.
Env -> UiMode -> Language -> Palette -> (Html -> a) -> View a
GenreCreatePage Env
env UiMode
mode Language
language Palette
palette Html -> Free f Html
forall (f :: * -> *) a. a -> Free f a
Pure)

songListPage :: (View :<: f) => Env -> UiMode -> Language -> Palette -> SortOrder -> GetSongsQueryResponse -> Free f Html
songListPage :: forall (f :: * -> *).
(View :<: f) =>
Env
-> UiMode
-> Language
-> Palette
-> SortOrder
-> GetSongsQueryResponse
-> Free f Html
songListPage Env
env UiMode
mode Language
language Palette
palette SortOrder
sortOrder GetSongsQueryResponse
songs = View (Free f Html) -> Free f Html
forall (g :: * -> *) (f :: * -> *) a.
(g :<: f) =>
g (Free f a) -> Free f a
injectFree (Env
-> UiMode
-> Language
-> Palette
-> SortOrder
-> GetSongsQueryResponse
-> (Html -> Free f Html)
-> View (Free f Html)
forall a.
Env
-> UiMode
-> Language
-> Palette
-> SortOrder
-> GetSongsQueryResponse
-> (Html -> a)
-> View a
SongListPage Env
env UiMode
mode Language
language Palette
palette SortOrder
sortOrder GetSongsQueryResponse
songs Html -> Free f Html
forall (f :: * -> *) a. a -> Free f a
Pure)

songDetailPage :: (View :<: f) => Env -> UiMode -> Language -> Palette -> SongAsciiSize -> GetSongsQueryResponse -> Free f Html
songDetailPage :: forall (f :: * -> *).
(View :<: f) =>
Env
-> UiMode
-> Language
-> Palette
-> SongAsciiSize
-> GetSongsQueryResponse
-> Free f Html
songDetailPage Env
env UiMode
mode Language
language Palette
palette SongAsciiSize
songAsciiSize GetSongsQueryResponse
songs = View (Free f Html) -> Free f Html
forall (g :: * -> *) (f :: * -> *) a.
(g :<: f) =>
g (Free f a) -> Free f a
injectFree (Env
-> UiMode
-> Language
-> Palette
-> SongAsciiSize
-> GetSongsQueryResponse
-> (Html -> Free f Html)
-> View (Free f Html)
forall a.
Env
-> UiMode
-> Language
-> Palette
-> SongAsciiSize
-> GetSongsQueryResponse
-> (Html -> a)
-> View a
SongDetailPage Env
env UiMode
mode Language
language Palette
palette SongAsciiSize
songAsciiSize GetSongsQueryResponse
songs Html -> Free f Html
forall (f :: * -> *) a. a -> Free f a
Pure)

songCreatePage :: (View :<: f) => Env -> UiMode -> Language -> Palette -> Free f Html
songCreatePage :: forall (f :: * -> *).
(View :<: f) =>
Env -> UiMode -> Language -> Palette -> Free f Html
songCreatePage Env
env UiMode
mode Language
language Palette
palette = View (Free f Html) -> Free f Html
forall (g :: * -> *) (f :: * -> *) a.
(g :<: f) =>
g (Free f a) -> Free f a
injectFree (Env
-> UiMode
-> Language
-> Palette
-> (Html -> Free f Html)
-> View (Free f Html)
forall a.
Env -> UiMode -> Language -> Palette -> (Html -> a) -> View a
SongCreatePage Env
env UiMode
mode Language
language Palette
palette Html -> Free f Html
forall (f :: * -> *) a. a -> Free f a
Pure)

errorPage :: (View :<: f) => Env -> UiMode -> Language -> Palette -> Text -> Free f Html
errorPage :: forall (f :: * -> *).
(View :<: f) =>
Env -> UiMode -> Language -> Palette -> Text -> Free f Html
errorPage Env
env UiMode
mode Language
message Palette
l Text
palette = View (Free f Html) -> Free f Html
forall (g :: * -> *) (f :: * -> *) a.
(g :<: f) =>
g (Free f a) -> Free f a
injectFree (Env
-> UiMode
-> Language
-> Palette
-> Text
-> (Html -> Free f Html)
-> View (Free f Html)
forall a.
Env
-> UiMode -> Language -> Palette -> Text -> (Html -> a) -> View a
ErrorPage Env
env UiMode
mode Language
message Palette
l Text
palette Html -> Free f Html
forall (f :: * -> *) a. a -> Free f a
Pure)

loginPage :: (View :<: f) => Env -> UiMode -> Language -> Palette -> Free f Html
loginPage :: forall (f :: * -> *).
(View :<: f) =>
Env -> UiMode -> Language -> Palette -> Free f Html
loginPage Env
env UiMode
mode Language
language Palette
palette = View (Free f Html) -> Free f Html
forall (g :: * -> *) (f :: * -> *) a.
(g :<: f) =>
g (Free f a) -> Free f a
injectFree (Env
-> UiMode
-> Language
-> Palette
-> (Html -> Free f Html)
-> View (Free f Html)
forall a.
Env -> UiMode -> Language -> Palette -> (Html -> a) -> View a
LoginPage Env
env UiMode
mode Language
language Palette
palette Html -> Free f Html
forall (f :: * -> *) a. a -> Free f a
Pure)