using System;
using Cute;
using UnityEngine;

namespace Wizard;

public class UserListViewPlate : UserPlateBase
{
	[SerializeField]
	private UIButton _actionButton;

	[SerializeField]
	private UILabel _actionButtonLabel;

	[SerializeField]
	private GameObject _underLine;

	public Action<UserInfoBase> OnAction { get; set; }

	public void Initialize(UserInfoBase userInfo, string actionButtonLabel)
	{
		InitializeBase(userInfo);
		_actionButtonLabel.text = actionButtonLabel;
		_actionButton.onClick.Clear();
		_actionButton.onClick.Add(new EventDelegate(delegate
		{
			OnAction.Call(userInfo);
		}));
	}

	public void SetUnderLine(bool visible)
	{
		if (_underLine != null)
		{
			_underLine.SetActive(visible);
		}
	}

	public void SetButtonVisible(bool visible)
	{
		_actionButton.gameObject.SetActive(visible);
	}
}
