Files
KnockOutWhist-Web/knockoutwhistweb/app/dto/subDTO/CardDTO.scala
Janis fa3d21e303 fix: FRO-29 Websocket Communication (#104)
Reviewed-on: #104
Co-authored-by: Janis <janis.e.20@gmx.de>
Co-committed-by: Janis <janis.e.20@gmx.de>
2025-12-10 09:42:50 +01:00

32 lines
608 B
Scala

package dto.subDTO
import de.knockoutwhist.cards.Card
import util.WebUIUtils
case class CardDTO(identifier: String, path: String, idx: Option[Int]) {
def toCard: Card = {
WebUIUtils.stringToCard(identifier)
}
}
object CardDTO {
def apply(card: Card, index: Int): CardDTO = {
CardDTO(
identifier = WebUIUtils.cardtoString(card),
path = WebUIUtils.cardToPath(card),
idx = Some(index)
)
}
def apply(card: Card): CardDTO = {
CardDTO(
identifier = WebUIUtils.cardtoString(card),
path = WebUIUtils.cardToPath(card),
idx = None
)
}
}