using System;
using UnityEngine;
namespace Unity.Multiplayer.Center.Questionnaire
{
    /// 
    /// The serializable data of the questionnaire
    /// 
    [Serializable]
    internal class QuestionnaireData
    {
        ///  The version of the format to serialize/deserialize data 
        public string FormatVersion = "1.0.0";
        ///  The version of the questionnaire itself (different questions, answer choice) 
        public string Version ="1.2";
        ///  All the questions in the right order (some might be hidden though) 
        public Question[] Questions;
        
        ///  The predefined answers for presets. The content should match the questions.
        public PresetData PresetData;
    }
    /// 
    /// Possible multiplayer solution that needs to be scored in order to assess a match. Some are mutually exclusive,
    /// some are not.
    /// 
    [Serializable]
    internal enum PossibleSolution
    {
        ///  Netcode for GameObject, incompatible with N4E 
        NGO,
        ///  Netcode for Entities, incompatible with NGO 
        N4E,
        ///  Client Hosted Architecture (also called "Listen server"; using a host and not a dedicated server) 
        LS,
        ///  Dedicated server architecture (using a dedicated server and not a host) 
        DS,
        
        ///  Distributed authority (Authority will be distributed across different players) 
        DA,
        
        ///  Not using Netcode for GameObjects nor Netcode for Entities 
        CustomNetcode,
        
        ///  Works asynchronously, with a database  
        NoNetcode,
        
        ///  Recommended backend for async games, without a Netcode (goes with )  
        CloudCode
    }
    [Serializable]
    internal enum ViewType
    {
        ///  Yes or No type of question best represented by a toggle
        Toggle,
        ///  A question with multiple choices and where you can select only one answer
        Radio,
        ///  A question with multiple choices and where you can select multiple answers
        Checkboxes,
        ///  A question with a Drop Down
        DropDown
    }
    [Serializable]
    internal class Question
    {
        ///  Id (unique across questions) 
        public string Id;
        ///  Short string to refer to the question (e.g. "Player Count") 
        public string Title;
        ///  Longer string to describe the question, which will be displayed in the tooltip 
        public string Description;
        ///  Optional weight to increase/decrease importance of this question, applied to all answers.
        //TODO: use ignore if default
        public float GlobalWeight = 1f;
        ///  The type of view to use to display the question 
        public ViewType ViewType;
        ///  The possible answers to the question 
        public Answer[] Choices;
        ///  If the question is mandatory or not. Not overwritten by presets 
        public bool IsMandatory;
    }
    [Serializable]
    internal class Answer
    {
        ///  Id (unique across answers) 
        public string Id;
        ///  What is displayed to the user 
        public string Title;
        
        ///  Optional description that will be shown in a tooltip 
        public string Description;
        ///  How picking this answer will impact the score of a given solution 
        public ScoreImpact[] ScoreImpacts;
    }
    [Serializable]
    internal class ScoreImpact
    {
        ///  Which score is impacted 
        public PossibleSolution Solution;
        ///  Absolute value to add or subtract from the target score
        public float Score;
        ///  A comment displayed to the user as for why this score is impacted  
        public string Comment;
    }
}