package com.libreecm.db.auxiliars;

import com.libreecm.db.jpa.users.LibreECMUser;
import com.libreecm.db.jpa.users.Role;

public class Mapper {
 
	public static LibreECMUser map(com.libreecm.commonAPI.model.users.LibreECMUser element) {
		LibreECMUser result = new LibreECMUser();
		result.setId(element.getId());
		result.setPassword(element.getPassword());
		result.setRole(map(element.getRole()));
		result.setUsername(element.getUsername());
		result.setAccountNonExpired(element.isAccountNonExpired());
		result.setAccountNonLocked(element.isAccountNonLocked());
		result.setEnabled(element.isEnabled());
		result.isAccountNonExpired();
		return result;
	}

	private static Role map(com.libreecm.commonAPI.model.users.Role element) {
		return Role.valueOf(element.name());
	}

}
