module Anki.Card (
CardId
, Card(..)
) where
import Anki.Common (ModificationTime)
import Anki.Deck (DeckId)
import Anki.Note (NoteId)
import Data.Text (Text)
import Database.SQLite.Simple (FromRow(..), field)
import GHC.Generics (Generic)
type CardId = Int
data Card = Card {
cardId :: CardId
, cardNid :: NoteId
, cardDid :: DeckId
, cardOrd :: Int
, cardMod :: ModificationTime
, cardUsn :: Int
, cardType :: Int
, cardQueue :: Int
, cardDue :: Int
, cardIvl :: Int
, cardFactor :: Int
, cardReps :: Int
, cardLapses :: Int
, cardLeft :: Int
, cardOdue :: Int
, cardOdid :: Int
, cardFlags :: Int
, cardData :: Text
} deriving (Show, Eq, Generic)
instance FromRow Card where
fromRow = Card
<$> field
<*> field
<*> field
<*> field
<*> field
<*> field
<*> field
<*> field
<*> field
<*> field
<*> field
<*> field
<*> field
<*> field
<*> field
<*> field
<*> field
<*> field