package com.pixelized.desktop.lwa.ui.screen.campaign.toolbar.network

import com.pixelized.desktop.lwa.repository.network.NetworkRepository.Status

class NetworkFactory {

    fun convertToUio(
        player: String,
        status: Status,
        host: String,
        resetHost: Boolean,
        port: Int,
        resetPort: Boolean,
    ): NetworkPageUio {
        return NetworkPageUio(
            player = player,
            host = host,
            resetHost = resetHost,
            port = "$port",
            resetPort = resetPort,
            enableFields = status == Status.DISCONNECTED,
            enableActions = status == Status.DISCONNECTED && player.isNotBlank() && host.isNotBlank() && port > 0,
            enableCancel = status == Status.CONNECTED,
        )
    }
}