﻿using System;
using BungieSharp.Enums;
using Newtonsoft.Json;

namespace BungieSharp.Models {
    /// <summary>
    /// A Representation of a Destiny Character.
    /// </summary>
    public class Character {
        /// <summary>
        /// Contains most of the Character Data.
        /// </summary>
        [JsonProperty("characterBase")]
        public CharacterBase Base { get; private set; }
        /// <summary>
        /// The character's level.
        /// </summary>
        [JsonProperty("characterLevel")]
        public int Level { get; private set; }
        /// <summary>
        /// The www.bungie.net url for the character's current emblem. (Only the square part of it)
        /// </summary>
        [JsonProperty("emblemPath")]
        public string EmblemPath { get; private set; }
        /// <summary>
        /// The www.bungie.net url for the charater's current emblem's background.
        /// </summary>
        [JsonProperty("backgroundPath")]
        public string BackgroundPath { get; private set; }
        /// <summary>
        /// The hash for the character's current emblem.
        /// </summary>
        [JsonProperty("emblemHash")]
        public string EmblemHash { get; private set; }

        /// <summary>
        /// Data structure in order to mirror the API.
        /// </summary>
        public class CharacterBase {
            /// <summary>
            /// This character's membership ID. (That is, the player that owns it.)
            /// </summary>
            [JsonProperty("membershipId")]
            public string MembershipId { get; private set; }
            /// <summary>
            /// This character's membership's type. (That is, what platform its owner is on.)
            /// </summary>
            [JsonProperty("membershipType")]
            public MembershipType MembershipType { get; private set; }
            /// <summary>
            /// This character's id.
            /// </summary>
            [JsonProperty("characterId")]
            public string CharacterId { get; private set; }
            /// <summary>
            /// The date and time this character was last played.
            /// </summary>
            [JsonProperty("dateLastPlayed")]
            public DateTime DateLastPlayed { get; private set; }
            /// <summary>
            /// The total amount of minutes this character has been played.
            /// </summary>
            [JsonProperty("minutesPlayedTotal")]
            public int MinutesPlayedTotal { get; private set; }
            /// <summary>
            /// The character's race.
            /// </summary>
            [JsonProperty("raceHash")]
            public DestinyRace Race { get; private set; }
            /// <summary>
            /// The character's gender.
            /// </summary>
            [JsonProperty("genderHash")]
            public DestinyGender Gender { get; private set; }
            /// <summary>
            /// The character's class.
            /// </summary>
            [JsonConverter(typeof(DestinyClassConverter))]
            [JsonProperty("classHash")]
            public DestinyClass Class { get; private set; }
            /// <summary>
            /// The character's current light level. The weird name comes from the Bungie API.
            /// </summary>
            [JsonProperty("powerLevel")]
            public int PowerLevel { get; private set; }


        }

    }
}
