using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

public class QuestionCard : MonoBehaviour
{
    public Text questionText;
    public Text answerText;

    public GameObject questionTextPanel;

    public string questionString = "";
    public string answerString = "";
    public string idString = "";
    public string categoryString = "";

    public Color32 unsafeColor;
    public Color32 safeColor;

    public void SetQuestionSafe()
    {
        this.GetComponent<Image>().color = safeColor;
    }

    internal void SetQuestionUnSafe() {
        this.GetComponent<Image>().color = unsafeColor;
    }
    public bool IsQuestionSafe() {
        if (this.GetComponent<Image>().color == safeColor) {
            return true;
        }
        return false;
    }

    public void SetQuestionCategoryColor(Color32 questionCategoryColor) {
        questionTextPanel.GetComponent<Image>().color = questionCategoryColor;
    }

    public void SetQuestionText(string text) {
        this.questionText.text = text;
    }
    public void SetAnswerText(string text) {
        this.answerText.text = text;
    }

    public Text GetQuestionText() {
        return this.questionText;
    }

    public Text GetAnswerText() {
        return this.answerText;
    }

    public int GetCategoryId() {
        Int32.TryParse(categoryString, out int result);
        return result;
    }

    internal int GetId() {
        Int32.TryParse(idString, out int result);
        return result;
    }

}
