module LoggedIn.Income.Update exposing
  ( update
  )

import Form exposing (Form)

import LoggedData exposing (LoggedData)

import LoggedIn.Income.Model as IncomeModel
import LoggedIn.Income.Msg as IncomeMsg

update : LoggedData -> IncomeMsg.Msg -> IncomeModel.Model -> (IncomeModel.Model, Cmd IncomeMsg.Msg)
update loggedData msg model =
  case msg of

    IncomeMsg.NoOp ->
      ( model
      , Cmd.none
      )

    IncomeMsg.AddIncomeMsg formMsg ->
      ( { model | addIncome = Form.update formMsg model.addIncome }
      , Cmd.none
      )

    IncomeMsg.ToggleTest ->
      ( { model | test = not model.test }
      , Cmd.none
      )