/* © SRSoftware 2025 */
package de.srsoftware.umbrella.core.model;


import static de.srsoftware.umbrella.core.constants.Field.PERMISSION;
import static de.srsoftware.umbrella.core.constants.Field.USER;

import de.srsoftware.tools.Mappable;
import java.util.HashMap;
import java.util.Map;

public record Member(UmbrellaUser user, Permission permission) implements Mappable {
	@Override
	public Map<String, Object> toMap() {
		var map = new HashMap<String,Object>();
		map.put(USER,user == null ? null : user.toMap());
		map.put(PERMISSION,permission.toMap());
		return map;
	}

	public boolean mayWrite() {
		return permission.mayWrite();
	}
}
