using dodohold.core;
using System.Text.Json.Serialization;
using YunhuiKit;

namespace molilian.core
{
    [Table("promotion_query_samples")]
    public class PromotionQuerySampleDTO
    {
        [Key]
        public string id { get; set; } = string.Empty;
        public string ip { get; set; } = string.Empty;
        public string oaid { get; set; } = string.Empty;
        public string image_base64 { get; set; } = string.Empty;
        public string response_json { get; set; } = string.Empty;

        [IgnoreUpdate]
        [JsonConverter(typeof(NullableDateTimeConverter))]
        public DateTime create_time { get; set; }
    }

    public class PromotionQuerySampleLogDTO
    {
        public string id { get; set; } = string.Empty;
        public string fileName { get; set; } = string.Empty;
        public string writeTime { get; set; } = string.Empty;
        public string content { get; set; } = string.Empty;
        public string ip { get; set; } = string.Empty;
        public string oaid { get; set; } = string.Empty;
        public string imageBase64 { get; set; } = string.Empty;
        public string responseJson { get; set; } = string.Empty;
    }

    public class PromotionQuerySampleQueryResultDTO
    {
        public int page { get; set; } = 1;
        public int pageSize { get; set; }
        public int totalCount { get; set; }
        public int totalPages => pageSize <= 0 || totalCount <= 0 ? 0 : (int)Math.Ceiling(totalCount / (double)pageSize);
        public List<PromotionQuerySampleLogDTO> logs { get; set; } = new();
    }
}
