package it.integry.integrywmsnative.core.settings;

import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;

public class SettingsModel {

    private Server server;
    private User user;
    private UserSession userSession;

    public boolean isUserLoggedIn() {
        return user != null;
    }

    public void createUserSession() {
        this.user = new User();
        this.userSession = new UserSession();
    }


    public static class Server {
        private String codAzienda;
        private String protocol;
        private String host;
        private int port;

        public String getCodAzienda() {
            return codAzienda;
        }

        public Server setCodAzienda(String codAzienda) {
            this.codAzienda = codAzienda;
            return this;
        }

        public String getProtocol() {
            return protocol == null ? "http" : protocol;
        }

        public Server setProtocol(String protocol) {
            this.protocol = protocol;
            return this;
        }

        public String getHost() {
            return host;
        }

        public Server setHost(String host) {
            this.host = host;
            return this;
        }

        public int getPort() {
            return port;
        }

        public Server setPort(int port) {
            this.port = port;
            return this;
        }
    }

    public static class User {
        private String username;
        private String password;
        private String fullname;

        public String getUsername() {
            return username;
        }

        public User setUsername(String username) {
            this.username = username;
            return this;
        }

        public String getPassword() {
            return password;
        }

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

        public String getFullname() {
            return fullname;
        }

        public User setFullname(String fullname) {
            this.fullname = fullname;
            return this;
        }
    }

    public static class UserSession {
        private String deviceId;
        private String profileDB;
        private AvailableCodMdepsDTO depo;
        private Integer defaultOrdinamentoPickingAccettazione = 0;
        private Integer defaultOrdinamentoPickingAccettazioneBolle = 0;

        public String getDeviceId() {
            return deviceId;
        }

        public void setDeviceId(String deviceId) {
            this.deviceId = deviceId;
        }

        public String getProfileDB() {
            return profileDB;
        }

        public UserSession setProfileDB(String profileDB) {
            this.profileDB = profileDB;
            return this;
        }

        public AvailableCodMdepsDTO getDepo() {
            return depo;
        }

        public UserSession setDepo(AvailableCodMdepsDTO depo) {
            this.depo = depo;
            return this;
        }

        public Integer getDefaultOrdinamentoPickingAccettazione() {
            return defaultOrdinamentoPickingAccettazione;
        }

        public UserSession setDefaultOrdinamentoPickingAccettazione(Integer defaultOrdinamentoPickingAccettazione) {
            this.defaultOrdinamentoPickingAccettazione = defaultOrdinamentoPickingAccettazione;
            return this;
        }

        public Integer getDefaultOrdinamentoPickingAccettazioneBolle() {
            return defaultOrdinamentoPickingAccettazioneBolle;
        }

        public UserSession setDefaultOrdinamentoPickingAccettazioneBolle(Integer defaultOrdinamentoPickingAccettazioneBolle) {
            this.defaultOrdinamentoPickingAccettazioneBolle = defaultOrdinamentoPickingAccettazioneBolle;
            return this;
        }
    }

    public Server getServer() {
        return server;
    }

    public SettingsModel setServer(Server server) {
        this.server = server;
        return this;
    }

    public User getUser() {
        return user;
    }

    public SettingsModel setUser(User user) {
        this.user = user;
        return this;
    }

    public UserSession getUserSession() {
        return userSession;
    }

    public SettingsModel setUserSession(UserSession userSession) {
        this.userSession = userSession;
        return this;
    }
}
