using System.Text.Json.Serialization;

namespace goods.Models.Coupang.Search
{
    public class Response
    {
        [JsonPropertyName("rCode")]
        public string RCode { get; set; } = null!;

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

        [JsonPropertyName("data")]
        public DataContainer? Data { get; set; } // data를 별도 객체로 매핑
    }

    public class DataContainer
    {
        [JsonPropertyName("landingUrl")]
        public string? LandingUrl { get; set; }

        [JsonPropertyName("productData")]
        public List<Data>? ProductData { get; set; } // productData를 List로 매핑
    }

    public class Data
    {
        [JsonPropertyName("keyword")]
        public string Keyword { get; set; } = null!;

        [JsonPropertyName("rank")]
        public int Rank { get; set; }

        [JsonPropertyName("isRocket")]
        public bool IsRocket { get; set; }

        [JsonPropertyName("isFreeShipping")]
        public bool IsFreeShipping { get; set; }

        [JsonPropertyName("productId")]
        public long ProductId { get; set; }

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

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

        [JsonPropertyName("productPrice")]
        [JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)]
        public decimal ProductPrice { get; set; }

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