package com.fshark.overseas.advert.modle;

import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@NoArgsConstructor
@Data
public class TiktokModle implements Serializable {


    @SerializedName("tiktok_app_id")
    private Long tiktokAppId;
    @SerializedName("event")
    private String event;
    @SerializedName("timestamp")
    private String timestamp;
    @SerializedName("context")
    private ContextDTO context;
    @SerializedName("properties")
    private PropertiesDTO properties;

    @NoArgsConstructor
    @Data
    public static class ContextDTO {
        @SerializedName("app")
        private AppDTO app;
        @SerializedName("device")
        private DeviceDTO device;
        @SerializedName("locale")
        private String locale;
        @SerializedName("ip")
        private String ip;
        @SerializedName("userAgent")
        private String userAgent;
        @SerializedName("origin_url")
        private String originUrl;
        @SerializedName("ad")
        private AdDTO ad;

        @NoArgsConstructor
        @Data
        public static class AppDTO {
            @SerializedName("id")
            private String id;
            @SerializedName("name")
            private String name;
            @SerializedName("namespace")
            private String namespace;
            @SerializedName("version")
            private String version;
            @SerializedName("build")
            private String build;
        }

        @NoArgsConstructor
        @Data
        public static class DeviceDTO {
            @SerializedName("platform")
            private String platform;
            @SerializedName("idfa")
            private String idfa;
            @SerializedName("idfv")
            private String idfv;
        }

        @NoArgsConstructor
        @Data
        public static class AdDTO {
            @SerializedName("placement")
            private String placement;
            @SerializedName("match_type")
            private String matchType;
            @SerializedName("attributed")
            private Boolean attributed;
            @SerializedName("ad_id")
            private Long adId;
            @SerializedName("campaign_id")
            private Long campaignId;
            @SerializedName("creative_id")
            private Long creativeId;
            @SerializedName("isRetargeting")
            private boolean isRetargeting ;
            @SerializedName("attributionType")
            private String attributionType;
            @SerializedName("attribution_provider")
            private String attributionProvider;
        }
    }

    @NoArgsConstructor
    @Data
    public static class PropertiesDTO {
        @SerializedName("currency")
        private String currency;
        @SerializedName("value")
        private Integer value;
        @SerializedName("contents")
        private List<ContentsDTO> contents;

        @NoArgsConstructor
        @Data
        public static class ContentsDTO {
            @SerializedName("price")
            private Integer price;
            @SerializedName("quantity")
            private Integer quantity;
            @SerializedName("content_id")
            private String contentId;
        }
    }
}
