package com.alterdekim.game.component.game.response.init;

import com.alterdekim.game.component.game.ClubAccessType;
import com.alterdekim.game.component.game.RoleFlags;
import com.alterdekim.game.component.game.avatar.InitMagicAbility;
import com.alterdekim.game.xml.ClubAccessTypeSerializer;
import com.alterdekim.game.xml.LocalDateTimeSerializer;
import com.alterdekim.game.xml.NumericBooleanSerializer;
import com.alterdekim.game.xml.RoleFlagsSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;
import java.util.List;

@AllArgsConstructor
@Getter
@Setter
@JacksonXmlRootElement(localName = "user")
public class UserInfo {
    @JacksonXmlProperty(isAttribute = true, localName = "UserId")
    private Integer userId;

    @JacksonXmlProperty(isAttribute = true, localName = "Id")
    private Integer id;

    @JacksonXmlProperty(isAttribute = true, localName = "RoleFlags")
    @JsonSerialize(using = RoleFlagsSerializer.class)
    private RoleFlags roleFlags;

    @JacksonXmlProperty(isAttribute = true, localName = "IsVoteForInstructorAllowed")
    @JsonSerialize(using = NumericBooleanSerializer.class)
    private Boolean isVoteForInstructorAllowed;

    @JacksonXmlProperty(isAttribute = true, localName = "IsLimited")
    @JsonSerialize(using= NumericBooleanSerializer.class)
    private Boolean isLimited;

    @JacksonXmlProperty(isAttribute = true, localName = "IsOnline")
    @JsonSerialize(using= NumericBooleanSerializer.class)
    private Boolean isOnline;

    @JacksonXmlProperty(isAttribute = true, localName = "IsMinorSecretAgent")
    @JsonSerialize(using= NumericBooleanSerializer.class)
    private Boolean isMinorSecretAgent;

    @JacksonXmlProperty(isAttribute = true, localName = "IsHomeLocked")
    @JsonSerialize(using= NumericBooleanSerializer.class)
    private Boolean isHomeLocked;

    @JacksonXmlProperty(isAttribute = true, localName = "IsClubLocked")
    @JsonSerialize(using= NumericBooleanSerializer.class)
    private Boolean isClubLocked;

    @JacksonXmlProperty(isAttribute = true, localName = "IsClubPresent")
    @JsonSerialize(using= NumericBooleanSerializer.class)
    private Boolean isClubPresent;

    @JacksonXmlProperty(isAttribute = true, localName = "ClubAccessType")
    @JsonSerialize(using = ClubAccessTypeSerializer.class)
    private ClubAccessType clubAccessType;

    @JacksonXmlProperty(isAttribute = true, localName = "ClubCost")
    private Integer clubCost;

    @JacksonXmlProperty(isAttribute = true, localName = "IsFriend")
    @JsonSerialize(using= NumericBooleanSerializer.class)
    private Boolean isFriend;

    @JacksonXmlProperty(isAttribute = true, localName = "Experience")
    private Integer experience;

    @JacksonXmlProperty(isAttribute = true, localName = "Level")
    private Integer level;

    @JacksonXmlProperty(isAttribute = true, localName = "MagicLevel")
    private Integer magicLevel;

    @JacksonXmlProperty(isAttribute = true, localName = "RaceLevel")
    private Integer raceLevel;

    @JacksonXmlProperty(isAttribute = true, localName = "PhoneId")
    private Integer phoneId;

    @JacksonXmlProperty(isAttribute = true, localName = "BackgroundId")
    private Long backgroundId;

    @JacksonXmlProperty(isAttribute = true, localName = "CampId")
    private Integer campId;

    @JacksonXmlProperty(isAttribute = true, localName = "NiftTotalCount")
    private Integer niftTotalCount;

    @JacksonXmlProperty(isAttribute = true, localName = "LocationServerName")
    private String locationServerName;

    @JacksonXmlProperty(isAttribute = true, localName = "DateRegistered")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime dateRegistered;

    @JacksonXmlProperty(isAttribute = true, localName = "InstructorLevel")
    private Integer instructorLevel;

    @JacksonXmlProperty(isAttribute = true, localName = "UsualTickets")
    private Integer usualTickets;

    @JacksonXmlProperty(isAttribute = true, localName = "MagicTickets")
    private Integer magicTickets;

    @JacksonXmlProperty(isAttribute = true, localName = "VisaId")
    private Integer visaId;

    @JacksonXmlProperty(isAttribute = true, localName = "CurrentUseCount")
    private Integer currentUseCount;

    @JacksonXmlProperty(isAttribute = true, localName = "LastNewspaperId")
    private Integer lastNewspaperId;

    @JacksonXmlProperty(isAttribute = true, localName = "HasSnFriends")
    @JsonSerialize(using= NumericBooleanSerializer.class)
    private Boolean hasSnFriends;

    @JacksonXmlProperty(isAttribute = true, localName = "MinsLeft")
    private Integer minsLeft;

    @JacksonXmlProperty(isAttribute = true, localName = "TimesUsed")
    private Integer timesUsed;

    @JacksonXmlProperty(isAttribute = true, localName = "Name")
    private String name;

    // LocationTypeID

    @JacksonXmlProperty(isAttribute = true, localName = "AchievementsList")
    private String achievementsList;

    @JacksonXmlProperty(isAttribute = true, localName = "user_magic_abilities")
    @JacksonXmlElementWrapper(useWrapping = true, localName = "user_magic_abilities")
    private List<InitMagicAbility> userMagicAbilities;
}
