All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.malliina.html.UserFeedback.scala Maven / Gradle / Ivy

There is a newer version: 6.9.4
Show newest version
package com.malliina.html

import com.malliina.html.UserFeedback.{Feedback, No, Success, Yes}
import io.circe.Codec

case class UserFeedback(message: String, isError: Boolean) derives Codec.AsObject:
  def toMap: Seq[(String, String)] = Seq(
    Feedback -> message,
    Success -> (if isError then No else Yes)
  )

object UserFeedback:
  val Feedback = "feedback"
  val Success = "success"
  val Yes = "yes"
  val No = "no"

  def success(message: String) = UserFeedback(message, isError = false)

  def error(message: String) = UserFeedback(message, isError = true)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy