/**
 * Copyright 2014 Confluent Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.confluent.kafka.schemaregistry.rest.entities;

import com.fasterxml.jackson.annotation.JsonProperty;

import org.hibernate.validator.constraints.NotEmpty;

public class Subject {

  @NotEmpty
  private String name;

  private String compatibility = "full";
  private String registration = "all";
  private String deprecation = "all";
  private String validators = null;

  public Subject(@JsonProperty("name") String name,
                 @JsonProperty("compatibility") String compatibility,
                 @JsonProperty("registration") String registration,
                 @JsonProperty("deprecation") String deprecation,
                 @JsonProperty("validators") String validators) {
    this.name = name;
    this.compatibility = compatibility;
    this.registration = registration;
    this.deprecation = deprecation;
    this.validators = validators;
  }

  public Subject(@JsonProperty("name") String name) {
    this.name = name;
  }

  @JsonProperty("name")
  public String getName() {
    return name;
  }

  @JsonProperty("name")
  public void setName(String name) {
    this.name = name;
  }

  @JsonProperty("compatibility")
  public String getCompatibility() {
    return this.compatibility;
  }

  @JsonProperty("compatibility")
  public void setCompatibility(String compatibility) {
    this.compatibility = compatibility;
  }

  @JsonProperty("registration")
  public String getRegistration() {
    return this.registration;
  }

  @JsonProperty("registration")
  public void setRegistration(String registration) {
    this.registration = registration;
  }

  @JsonProperty("deprecation")
  public String getDeprecation() {
    return this.deprecation;
  }

  @JsonProperty("deprecation")
  public void setDeprecation(String deprecation) {
    this.deprecation = deprecation;
  }

  @JsonProperty("validators")
  public String getValidators() {
    return this.validators;
  }

  @JsonProperty("validators")
  public void setValidators(String validators) {
    this.validators = validators;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    Subject subject = (Subject) o;

    if (!name.equals(subject.name)) {
      return false;
    }
    if (!this.compatibility.equals(subject.compatibility)) {
      return false;
    }
    if (!this.registration.equals(subject.registration)) {
      return false;
    }
    if (!this.deprecation.equals(subject.deprecation)) {
      return false;
    }
    if (!this.validators.equals(subject.validators)) {
      return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int result = name.hashCode();
    result = 31 * result + this.registration.hashCode();
    result = 31 * result + this.deprecation.hashCode();
    result = 31 * result + this.validators.hashCode();
    return result;
  }

}

@@ -859,121 +859,8 @@
 ll%22;
-%0A  private String registration = %22all%22;%0A  private String deprecation = %22all%22;%0A  private String validators = null;
 %0A%0A  
@@ -981,378 +981,74 @@
 lity
-,%0A                 @JsonProperty(%22registration%22) String registration,%0A                 @JsonProperty(%22deprecation%22) String deprecation,%0A                 @JsonProperty(%22validators%22) String validators) %7B%0A    this.name = name;%0A    this.compatibility = compatibility;%0A    this.registration = registration;%0A    this.deprecation = deprecation;%0A    this.validators = validators
+)%0A  %7B%0A    this.name = name;%0A    this.compatibility = compatibility
 ;%0A  
@@ -1536,677 +1536,8 @@
  %7D%0A%0A
-  @JsonProperty(%22registration%22)%0A  public String getRegistration() %7B%0A    return this.registration;%0A  %7D%0A%0A  @JsonProperty(%22registration%22)%0A  public void setRegistration(String registration) %7B%0A    this.registration = registration;%0A  %7D%0A%0A  @JsonProperty(%22deprecation%22)%0A  public String getDeprecation() %7B%0A    return this.deprecation;%0A  %7D%0A%0A  @JsonProperty(%22deprecation%22)%0A  public void setDeprecation(String deprecation) %7B%0A    this.deprecation = deprecation;%0A  %7D%0A%0A  @JsonProperty(%22validators%22)%0A  public String getValidators() %7B%0A    return this.validators;%0A  %7D%0A%0A  @JsonProperty(%22validators%22)%0A  public void setValidators(String validators) %7B%0A    this.validators = validators;%0A  %7D%0A%0A
   @O
@@ -1894,257 +1894,8 @@
    %7D
-%0A    if (!this.registration.equals(subject.registration)) %7B%0A      return false;%0A    %7D%0A    if (!this.deprecation.equals(subject.deprecation)) %7B%0A      return false;%0A    %7D%0A    if (!this.validators.equals(subject.validators)) %7B%0A      return false;%0A    %7D
 %0A%0A  
@@ -2022,131 +2022,21 @@
 his.
-registration.hashCode();%0A    result = 31 * result + this.deprecation.hashCode();%0A    result = 31 * result + this.validators
+compatibility
 .has
@@ -2067,11 +2067,10 @@
 lt;%0A  %7D%0A
-%0A
 %7D%0A

remove permissions settings from Subject class (although Subject class is currently unused).