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 ApiVersioncheckAnswer
    {
        [JsonProperty("languages")]
        public List<string> Languages { get; set; }

        [JsonProperty("data")]
        public List<ApiExhibitionVersion> Data { get; set; }
    }

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

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

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

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

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

        [JsonProperty("updateVersion")]
        public long UpdateVersion { get; set; }
    }

    public enum VersionStatus
    {
        ok,
        updated,
        deleted
    }

    public class ApiExhibit
    {
        [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<ApiPoi> Pois { get; set; }
    }

    public class ApiPoi
    {
        [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 float X { get; set; }

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

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

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