package com.caliverse.admin.Indicators.entity;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.List;
import java.util.Map;

@Getter
@Setter
@Document(collection = "userLogin")
@CompoundIndexes({
        @CompoundIndex(name = "logDay_userGuid_idx", def = "{'logDay': 1, 'userGuid': 1}")
})

public class UserLoginLogInfo extends LogInfoBase{
    @Indexed
    private String logDay;
    private String accountId;
    @Indexed
    private String userGuid;
    private String userNickname;
    private List<Map<String, Object>> sessions;
    private String firstLoginTime;
    private String lastLogoutTime;
    private Integer loginCount;
    private Double totalPlayTime;

    public UserLoginLogInfo(String logDay,
                            String accountId,
                            String userGuid,
                            String userNickname,
                            List<Map<String, Object>> sessions,
                            String firstLoginTime,
                            String lastLogoutTime,
                            Integer loginCount,
                            Double totalPlayTime)
    {
        super(StatisticsType.USER_LOGIN);

        this.logDay = logDay;
        this.accountId = accountId;
        this.userGuid = userGuid;
        this.userNickname = userNickname;
        this.sessions = sessions;
        this.firstLoginTime = firstLoginTime;
        this.lastLogoutTime = lastLogoutTime;
        this.loginCount = loginCount;
        this.totalPlayTime = totalPlayTime;
    }
}
