package com.caliverse.admin.domain.response;

import com.caliverse.admin.Indicators.entity.DauLogInfo;
import com.caliverse.admin.domain.entity.Currencys;
import com.caliverse.admin.domain.entity.Distinct;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.util.List;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class IndicatorsResponse {
    private int status;

    private String result;
    @JsonProperty("data")

    private ResultData resultData;
    @Data
    @Builder
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class ResultData {

        private String message;

        private Dashboard dashboard;
        @JsonProperty("user_statistics_list")
        private List<userStatistics> userStatisticsList;
        @JsonProperty("dau_list")
        private List<DauLogInfo> dauList;
        @JsonProperty("distinct")
        private List<Distinct> list;
        //Retention
        @JsonProperty("retention")
        private List<Retention> retentionList;
        //Segment
        @JsonProperty("start_dt")
        private String startDt;
        @JsonProperty("end_dt")
        private String endDt;
        @JsonProperty("segment")
        private List<Segment> segmentList;
        //플레이타임
        @JsonProperty("playtime")
        private List<Playtime> playtimeList;
        //재화
        @JsonProperty("currencys")
        private List<Currencys> currencysList;
        @JsonProperty("list")
        private List<DailyGoods> dailyGoods;

        // @JsonProperty("dau_list")
        // private List<DailyActiveUser> dailyActiveUserList;

    }

    @Data
    @Builder
    public static class Dashboard{
        private String date;
        private Dau dau;
        private NRU nru;
        private PU pu;
        private MCU mcu;
    }

    //이용자 지표
    @Data
    @Builder
    public static class userStatistics{
        private String date;
        private int dau;
        private int dglc;
        private int mcu;
        private long playtime;
        private int nru;
        private long readCapacity;
        private long writeCapacity;
        private int mau;
        private int wau;
        private int ugqCreate;
        private int serverCount;
    }
    
    @Data
    @Builder
    public static class Dau{
        private int count;
        private String updown;
        private String dif;
    }
    @Data
    @Builder
    public static class NRU{
        private int count;
        private String updown;
        private String dif;
    }
    @Data
    @Builder
    public static class PU{
        private int count;
        private String updown;
        private String dif;
    }
    @Data
    @Builder
    public static class MCU{
        private int count;
        private String updown;
        private String dif;
    }
    @Data
    @Builder
    public static class Retention{
        private LocalDate date;
        @JsonProperty("d-day")
        private List<Dday> dDay;
    }
    @Data
    @Builder
    public static class Dday{
        private String date;
        private String dif;
    }
    @Data
    @Builder
    public static class Segment{
        private String type;
        private String au;
        private String dif;
    }
    @Data
    @Builder
    public static class Playtime{
        private LocalDate date;
        @JsonProperty("user_cnt")
        private List userCnt;
        @JsonProperty("total_time")
        private Integer totalTime;
        @JsonProperty("average_time")
        private Integer averageTime;
    }
    @Data
    @Builder
    public static class DailyGoods{

        private LocalDate date;
        private List<Total> total;
        @JsonProperty("daily_data")
        private List<DailyData> dailyData;
    }
    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class Total{
        private LocalDate date;
        @JsonProperty("delta_type")
        private String deltaType;
        private int quantity;
        private String dif;
    }
    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class DailyData{
        @JsonProperty("delta_type")
        private String deltaType;
        private LocalDate date;
        private List<Currencys> data;
    }


}
