/*******************************************************************************
 * MIT License
 *
 * Copyright (c) Igor Conrado Alves de Lima <igorcadelima@gmail.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
 * associated documentation files (the "Software"), to deal in the Software without restriction,
 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or
 * substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
 * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *******************************************************************************/
package gavel.base.sanction;

import gavel.api.common.LogicalFormula;
import gavel.api.common.Status;
import gavel.api.sanction.Sanction;
import gavel.api.sanction.SanctionCategory;
import gavel.impl.common.DefaultStatus;
import gavel.impl.sanction.Sanctions;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Setter;

/**
 * @author igorcadelima
 *
 */
@Data
@AllArgsConstructor(access = AccessLevel.PROTECTED)
public abstract class AbstractSanction implements Sanction {
  private final String id;

  @Setter(AccessLevel.NONE)
  private Status status = DefaultStatus.ENABLED;

  private final LogicalFormula condition;
  private final SanctionCategory category;
  private final LogicalFormula content;

  @Override
  public boolean enable() {
    if (status == DefaultStatus.DISABLED) {
      status = DefaultStatus.ENABLED;
      return true;
    }
    return false;
  }

  @Override
  public boolean disable() {
    if (status == DefaultStatus.ENABLED) {
      status = DefaultStatus.DISABLED;
      return true;
    }
    return false;
  }

  @Override
  public String toString() {
    return new StringBuilder(Sanctions.getStructureName() + '(').append("id(" + id + "),")
                                                                .append("status(" + status + "),")
                                                                .append(
                                                                    "condition(" + condition + "),")
                                                                .append(
                                                                    "category(" + category + "),")
                                                                .append(content + ")")
                                                                .toString();
  }
}

@@ -1339,16 +1339,79 @@
 ction;%0A%0A
+import static gavel.impl.sanction.Sanctions.getStructureName;%0A%0A
 import g
@@ -1598,46 +1598,8 @@
 us;%0A
-import gavel.impl.sanction.Sanctions;%0A
 impo
@@ -2495,26 +2495,16 @@
 Builder(
-Sanctions.
 getStruc
@@ -2543,34 +2543,24 @@
  id + %22),%22)%0A
-          
             
@@ -2694,95 +2694,16 @@
     
-          .append(%0A                                                                    
+.append(
 %22con
@@ -2785,34 +2785,24 @@
         
-       
-   
 .append(
 %0A       
@@ -2797,77 +2797,8 @@
 end(
-%0A                                                                    
 %22cat
@@ -2878,34 +2878,37 @@
         
-          .append(
+.append(%22content(%22 + 
 content 
@@ -2911,29 +2911,20 @@
 ent + %22)
+)
 %22)%0A
-          
         

Fix toString return