using System;
using System.Collections.Generic;
using Top.Api.Util;

namespace Top.Api.Request
{
    /// <summary>
    /// TOP API: taobao.tbk.dg.material.recommend
    /// </summary>
    public class TbkDgMaterialRecommendRequest : BaseTopRequest<Top.Api.Response.TbkDgMaterialRecommendResponse>
    {
        /// <summary>
        /// 推广位id，mm_xxx_xxx_12345678三段式的最后一段数字（登录pub.alimama.com推广管理-推广位管理中查询）
        /// </summary>
        public Nullable<long> AdzoneId { get; set; }

        /// <summary>
        /// 智能匹配-设备号加密类型：MD5；使用智能推荐请先签署协议https://pub.alimama.com/fourth/protocol/common.htm?key=hangye_laxin
        /// </summary>
        public string DeviceEncrypt { get; set; }

        /// <summary>
        /// 智能匹配-设备号类型：IMEI，或者IDFA，或者UTDID（UTDID不支持MD5加密），或者OAID；使用智能推荐请先签署协议https://pub.alimama.com/fourth/protocol/common.htm?key=hangye_laxin
        /// </summary>
        public string DeviceType { get; set; }

        /// <summary>
        /// 智能匹配-设备号加密后的值（MD5加密需32位小写）；使用智能推荐请先签署协议https://pub.alimama.com/fourth/protocol/common.htm?key=hangye_laxin
        /// </summary>
        public string DeviceValue { get; set; }

        /// <summary>
        /// 选品库收藏夹id，获取收藏夹id参考文档：https://mos.m.taobao.com/union/page_20230109_175050_176?spm=a219t._portal_v2_pages_promo_goods_index_htm.0.0.7c2a75a5H2ER3N
        /// </summary>
        public string FavoritesId { get; set; }

        /// <summary>
        /// 淘宝客新商品ID；用于相似商品推荐（注意：使用相似商品推荐material_id=13256必传，并请先签署协议https://pub.alimama.com/fourth/protocol/common.htm?key=hangye_laxin)；另关于《淘宝客新商品ID升级》参考白皮书：https://www.yuque.com/taobaolianmengguanfangxiaoer/zmig94/tfyt0pahmlpzu2ud
        /// </summary>
        public string ItemId { get; set; }

        /// <summary>
        /// 官方提供的物料Id；可以通过taobao.tbk.optimus.tou.material.ids.get接口获取公开的物料id列表或查看物料id汇总贴：https://market.m.taobao.com/app/qn/toutiao-new/index-pc.html#/detail/10628875?_k=gpov9a
        /// </summary>
        public Nullable<long> MaterialId { get; set; }

        /// <summary>
        /// 第几页，默认：1
        /// </summary>
        public Nullable<long> PageNo { get; set; }

        /// <summary>
        /// 页大小，默认20，1~100
        /// </summary>
        public Nullable<long> PageSize { get; set; }

        /// <summary>
        /// 1-自购省，2-推广赚（代理模式专属ID，代理模式必填，非代理模式不用填写该字段）
        /// </summary>
        public string PromotionType { get; set; }

        /// <summary>
        /// 渠道关系ID，仅适用于渠道推广场景
        /// </summary>
        public Nullable<long> RelationId { get; set; }

        /// <summary>
        /// 会员运营ID
        /// </summary>
        public string SpecialId { get; set; }

        #region ITopRequest Members

        public override string GetApiName()
        {
            return "taobao.tbk.dg.material.recommend";
        }

        public override IDictionary<string, string> GetParameters()
        {
            TopDictionary parameters = new TopDictionary();
            parameters.Add("adzone_id", this.AdzoneId);
            parameters.Add("device_encrypt", this.DeviceEncrypt);
            parameters.Add("device_type", this.DeviceType);
            parameters.Add("device_value", this.DeviceValue);
            parameters.Add("favorites_id", this.FavoritesId);
            parameters.Add("item_id", this.ItemId);
            parameters.Add("material_id", this.MaterialId);
            parameters.Add("page_no", this.PageNo);
            parameters.Add("page_size", this.PageSize);
            parameters.Add("promotion_type", this.PromotionType);
            parameters.Add("relation_id", this.RelationId);
            parameters.Add("special_id", this.SpecialId);
            if (this.otherParams != null)
            {
                parameters.AddAll(this.otherParams);
            }
            return parameters;
        }

        public override void Validate()
        {
            RequestValidator.ValidateRequired("adzone_id", this.AdzoneId);
            RequestValidator.ValidateRequired("material_id", this.MaterialId);
        }

        #endregion
    }
}
