package com.dowstats.data.dto.controllers

import com.dowstats.data.entities.building.Building
import com.dowstats.data.entities.unit.DowUnit
import com.dowstats.data.entities.sergant.Sergeant
import com.dowstats.data.entities.weapon.Weapon


data class EntityCompressDto(
    val name: String?,
    val icon: String?,
    val id: Long,
    val filename: String?,
)

object EntityCompressDtoObject {
    fun Sergeant.compressDto(): EntityCompressDto =
        EntityCompressDto(
            this.name,
            this.icon,
            this.id!!,
            this.filename
        )

    fun DowUnit.compressDto(): EntityCompressDto =
        EntityCompressDto(
            this.name,
            this.icon,
            this.id!!,
            this.filenameSquad + ";" + this.filenameUnit
        )

    fun Building.compressDto(): EntityCompressDto =
        EntityCompressDto(
            this.name,
            this.icon,
            this.id!!,
            this.filename
        )

    fun Weapon.compressDto(): EntityCompressDto =
        EntityCompressDto(
            this.name,
            this.icon,
            this.id!!,
            this.filename
        )
}