package premium_store.controller.DTO;

import com.fasterxml.jackson.annotation.JsonProperty;
import premium_store.model.GameClient;
import premium_store.model.UserRole;

//класс, который соединяет танки клиента в одну строчку (нам так захотелось)
public class SupportClientDTO {
    private long id;
    private String login;
    private String password;
    private String email;
    private Integer balance;
    private Long tankId;
    private UserRole role;

    public SupportClientDTO(){ }

    public SupportClientDTO(GameClient gameClient){
        this.id = gameClient.getId();
        this.login = gameClient.getLogin();
        this.password = gameClient.getPassword();
        this.email = gameClient.getEmail();
        this.balance = gameClient.getBalance();
        this.role = gameClient.getRole();
        if(gameClient.getTanks().size() >= 1){
            this.tankId = gameClient.getTanks().get(gameClient.getTanks().size() - 1).getId();
        }
        else {
            this.tankId = null;
        }
    }

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    public long getId(){
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getLogin(){
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getPassword(){
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail(){
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getBalance(){
        return balance;
    }

    public void setBalance(Integer balance) {
        this.balance = balance;
    }

    public Long getTankId(){
        return tankId;
    }

    public void setTankId(Long tankId) {
        this.tankId = tankId;
    }

    public UserRole getRole() {
        return role;
    }

    public void setRole(UserRole role) {
        this.role = role;
    }
}