package it.unisannio.ding.ids.wedroid.wrapper.entity; import com.google.gson.annotations.SerializedName; /** * Describes the properties of the new board */ public class BoardPrototype { private String title; private String owner; private boolean isAdmin; private boolean isActive; private boolean isNoComments; private boolean isCommentOnly; private BoardPermission permission; @SerializedName("color") private BoardBackgroundColor backgroundColor; private BoardPrototype( String title, String owner, boolean isAdmin, boolean isActive, boolean isNoComments, boolean isCommentOnly, BoardPermission permission, BoardBackgroundColor backgroundColor ) { this.title = title; this.owner = owner; this.isAdmin = isAdmin; this.isActive = isActive; this.isNoComments = isNoComments; this.isCommentOnly = isCommentOnly; this.permission = permission; this.backgroundColor = backgroundColor; } public static class Builder { private String title; private String owner; private boolean isActive = true; private MemberPermission memberPermission = MemberPermission.ADMIN; private BoardPermission boardPermission = BoardPermission.PRIVATE; private BoardBackgroundColor backgroundColor = BoardBackgroundColor.BELIZE; public Builder() { } /** * Create a new BoardPrototype * * @return The board prototype */ public BoardPrototype build() { return new BoardPrototype( title, owner, memberPermission.isAdmin(), isActive, memberPermission.isNoComments(), memberPermission.isCommentOnly(), boardPermission, backgroundColor ); } /** * Set the title of the new board. * * @param title The title of the new board */ public Builder setTitle(String title) { this.title = title; return this; } /** * Set the owner of the new board. * * @param owner The owner of the new board */ public Builder setOwner(String owner) { this.owner = owner; return this; } /** * Set the owner like an active member of the new board. * * @param active True by default */ public Builder setActive(boolean active) { isActive = active; return this; } /** * Set the permission of the owner on the new board. * * @param memberPermission ADMIN by default * @see MemberPermission */ public Builder setMemberPermission(MemberPermission memberPermission) { this.memberPermission = memberPermission; return this; } /** * Set the visibility of the new board. * * @param boardPermission PRIVATE by default * @see BoardPermission */ public Builder setBoardPermission(BoardPermission boardPermission) { this.boardPermission = boardPermission; return this; } /** * Set the background color of the new board. * * @param backgroundColor BELIZE by default * @see BoardBackgroundColor */ public Builder setBackgroundColor(BoardBackgroundColor backgroundColor) { this.backgroundColor = backgroundColor; return this; } } }