package com.miya.fastcashier.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;

import com.miya.fastcashier.R;
import com.miya.fastcashier.databinding.LayoutCommonPromptViewBinding;

import org.jetbrains.annotations.NotNull;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;

public class CommonPromptView extends ConstraintLayout {

    private LayoutCommonPromptViewBinding viewBinding;

    public CommonPromptView(@NonNull @NotNull Context context) {
        this(context, null);
    }

    public CommonPromptView(@NonNull @NotNull Context context,
                            @Nullable @org.jetbrains.annotations.Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public CommonPromptView(@NonNull @NotNull Context context,
                            @Nullable @org.jetbrains.annotations.Nullable AttributeSet attrs,
                            int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        View inflate = LayoutInflater.from(getContext()).inflate(R.layout.layout_common_prompt_view, this);
        viewBinding = LayoutCommonPromptViewBinding.bind(inflate);
    }

    public void setPromptImage(int imageResId) {
        viewBinding.ivPrompt.setImageResource(imageResId);
    }

    public void setPromptText(String text) {
        viewBinding.tvPrompt.setText(text);
    }
}
