package com.iofferyoutea.WitchQueen

import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.BitmapFont
import com.badlogic.gdx.scenes.scene2d.ui.Container
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton
import com.badlogic.gdx.scenes.scene2d.ui.Label
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable

class PlayerButton {
    enum class STATE { EMPTY, CONNECTING, FILLED }

    // Player Profile
    val profileButtonStyle = ImageButton.ImageButtonStyle(
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png"))
    )
    val profileButton = ImageButton(profileButtonStyle)

    // Player Username
    val usernameStyle = Label.LabelStyle(BitmapFont(), Color.BLACK)
    val username = Label("default", usernameStyle)

    //region Player Items
    val item1ButtonStyle = ImageButton.ImageButtonStyle(
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png"))
    )
    val item1Button = ImageButton(item1ButtonStyle)
    val item2ButtonStyle = ImageButton.ImageButtonStyle(
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png"))
    )
    val item2Button = ImageButton(item2ButtonStyle)
    val item3ButtonStyle = ImageButton.ImageButtonStyle(
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png"))
    )
    val item3Button = ImageButton(item3ButtonStyle)
    val item4ButtonStyle = ImageButton.ImageButtonStyle(
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png"))
    )
    val item4Button = ImageButton(item4ButtonStyle)
    //endregion

    // Leave Lobby - Only shows for local player on local player's button
    val leaveButtonStyle = ImageButton.ImageButtonStyle(
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png"))
    )
    val leaveButton = ImageButton(leaveButtonStyle)

    // Kick Player - Only shows for local player on remote player's button
    val kickButtonStyle = ImageButton.ImageButtonStyle(
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png")),
        TextureRegionDrawable(Texture("default.png"))
    )
    val kickButton = ImageButton(kickButtonStyle)

    val itemGroup = HorizontalGroup().apply {
        addActor(item1Button)
        addActor(item2Button)
        addActor(item3Button)
        addActor(item4Button)
    }

    val nameAndItemGroup = VerticalGroup().apply {
        addActor(username)
        addActor(itemGroup)
    }

    val playerGroup = HorizontalGroup().apply {
        addActor(profileButton)
        addActor(nameAndItemGroup)
        addActor(kickButton)
    }
}
