using System.Collections.Generic;
using System;
using Newtonsoft.Json;

namespace RothenburgAR.Updater
{
    [Serializable]
    public class ApiInfo
    {
        private static string baseUrl = "https://lambdalike.pa.kaim.network";

        public static string VersionCheckEndpoint
        {
            get { return baseUrl + "/versioncheck"; }
        }

        public static string ExhibitionEndpoint
        {
            get { return baseUrl + "/meta/{id}/{lang}"; }
        }
        public static string FileEndpoint
        {
            get { return baseUrl + "/files/{id}"; }
        }
        public static string TrackerEndpoint
        {
            get { return baseUrl + "/tracker/{id}"; }
        }
    }

    [Serializable]
    public class VersioncheckAnswer
    {
        [JsonProperty]
        public List<string> languages { get; set; }
        public List<ExhibitionVersion> data { get; set; }
    }

    [Serializable]
    public class ExhibitionVersion
    {
        [JsonProperty("id")]
        public string Id { get; set; }

        [JsonProperty("meta")]
        public VersionInfo Meta { get; set; }

        [JsonProperty("tracker")]
        public VersionInfo Tracker { get; set; }
    }

    [Serializable]
    public class VersionInfo
    {
        [JsonProperty("status")]
        public VersionStatus Status { get; set; }

        [JsonProperty("updateUrl")]
        public string UpdateUrl { get; set; }
    }

    public enum VersionStatus
    {
        ok,
        updated,
        deleted
    }

    public class Exhibit
    {
        [JsonProperty("id")]
        public string Id { get; set; }

        [JsonProperty("title")]
        public string Title { get; set; }

        [JsonProperty("description")]
        public string Description { get; set; }

        [JsonProperty("tags")]
        public List<string> Tags { get; set; }

        [JsonProperty("exhibitionIds")]
        public List<string> ExhibitionIds { get; set; }

        [JsonProperty("mediaId")]
        public string MediaId { get; set; }

        [JsonProperty("createdTime")]
        public long CreatedTime { get; set; }

        [JsonProperty("updatedTime")]
        public long UpdatedTime { get; set; }

        [JsonProperty("pois")]
        public List<Poi> Pois { get; set; }
    }

    public class Poi
    {
        [JsonProperty("id")]
        public string Id { get; set; }

        [JsonProperty("title")]
        public string Title { get; set; }

        [JsonProperty("description")]
        public string Description { get; set; }

        [JsonProperty("imageId")]
        public string ImageId { get; set; }

        [JsonProperty("mediaId")]
        public string MediaId { get; set; }

        [JsonProperty("x")]
        public double X { get; set; }

        [JsonProperty("y")]
        public double Y { get; set; }

        [JsonProperty("createdTime")]
        public long CreatedTime { get; set; }

        [JsonProperty("updatedTime")]
        public long UpdatedTime { get; set; }
    }
}