package com.ghost.technic;

import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.utils.DragListener;

public class CardView extends Image {
    private final String cardId;

    public CardView(TextureAtlas atlas, String cardId) {
        super(atlas.findRegion(cardId));
        this.cardId = cardId;

        setSize(150, 210); // Resize for display
        setTouchable(Touchable.enabled);

        addListener(new DragListener() {
            @Override
            public void drag(InputEvent event, float x, float y, int pointer) {
                moveBy(x - getWidth() / 2, y - getHeight() / 2);
            }
        });
    }

    public String getCardId() {
        return cardId;
    }
}
