using System.Text.Json.Serialization;

namespace XPrintServer.Api.Entities.Vol
{
    public class VolResult
    {
        public VolResult() { }

        [JsonPropertyName("code")]
        public int Code { get; set; }

        [JsonPropertyName("data")]
        public VolResultData Data { get; set; } = null!;

        [JsonPropertyName("message")]
        public string Message { get; set; } = string.Empty;

        [JsonPropertyName("request_id")]
        public string RequestId { get; set; } = string.Empty;

        [JsonPropertyName("status")]
        public int Status { get; set; }

        [JsonPropertyName("time_elapsed")]
        public string TimeElapsed { get; set; } = string.Empty;
    }

    public class QueryResult
    {
        public QueryResult() { }

        [JsonPropertyName("code")]
        public int Code { get; set; }

        [JsonPropertyName("data")]
        public QueryData Data { get; set; } = null!;

        [JsonPropertyName("message")]
        public string Message { get; set; } = string.Empty;

        [JsonPropertyName("request_id")]
        public string RequestId { get; set; } = string.Empty;

        [JsonPropertyName("time_elapsed")]
        public string TimeElapsed { get; set; } = string.Empty;
    }

    public class QueryData
    {
        //[JsonPropertyName("binary_data_base64")]
        //public string[] BinaryDataBase64 { get; set; } = null!;

        [JsonPropertyName("image_urls")]
        public string[] ImageUrls { get; set; } = null!;

        //[JsonPropertyName("video_url")]
        //public string VideoUrl { get; set; } = null!;


        [JsonPropertyName("video_url")]
        public string VideoUrl { get; set; } = null!;


        [JsonPropertyName("resp_data")]
        public string RespData { get; set; } = string.Empty;
        /// <summary>
        /// in_queue：任务已提交
        /// generating：任务已被消费，处理中
        /// done：处理完成，成功或者失败，可根据外层code&message进行判断
        /// not_found：任务未找到，可能原因是无此任务或任务已过期(12小时)
        /// expired：任务已过期，请尝试重新提交任务请求
        /// </summary>
        [JsonPropertyName("status")]
        public string Status { get; set; } = string.Empty;
    }

    public class RespData
    {
        [JsonPropertyName("urls")]
        public string[] Urls { get; set; } = null!;
    }

    /// <summary>
    /// algorithm_base_resp
    /// </summary>
    public class AlgorithmBaseResp
    {
        public AlgorithmBaseResp() { }

        [JsonPropertyName("status_code")]
        public int StatusCode { get; set; }

        [JsonPropertyName("status_message")]
        public string StatusMessage { get; set; } = string.Empty;
    }

    public class VolResultData
    {
        public VolResultData() { }

        [JsonPropertyName("algorithm_base_resp")]
        public AlgorithmBaseResp AlgorithmBaseResp { get; set; } = null!;

        [JsonPropertyName("status_message")]
        public string StatusMessage { get; set; } = null!;

        [JsonPropertyName("binary_data_base64")]
        public string[] BinaryDataBase64 { get; set; } = null!;

        [JsonPropertyName("image_urls")]
        public string[] ImageUrls { get; set; } = null!;

        [JsonPropertyName("infer_ctx")]
        public dynamic InferCtx { get; set; } = null!;

        [JsonPropertyName("llm_result")]
        public string LlmResult { get; set; } = null!;

        [JsonPropertyName("pe_result")]
        public string PeResult { get; set; } = null!;

        [JsonPropertyName("predict_tags_result")]
        public string PredictTagsResult { get; set; } = null!;

        [JsonPropertyName("rephraser_result")]
        public string RephraserResult { get; set; } = null!;

        [JsonPropertyName("request_id")]
        public string RequestId { get; set; } = null!;

        [JsonPropertyName("vlm_result")]
        public string VlmResult { get; set; } = null!;

        [JsonPropertyName("task_id")]
        public string TaskId { get; set; } = null!;
    }
}
