content: /*
   * Copyright (c) 2020-2025 Airbyte, Inc., all rights reserved.
   */
  
  package io.airbyte.config;
  
  import com.fasterxml.jackson.annotation.JsonCreator;
  import com.fasterxml.jackson.annotation.JsonInclude;
  import com.fasterxml.jackson.annotation.JsonProperty;
  import com.fasterxml.jackson.annotation.JsonPropertyDescription;
  import com.fasterxml.jackson.annotation.JsonPropertyOrder;
  import com.fasterxml.jackson.annotation.JsonValue;
  import jakarta.annotation.Generated;
  import java.io.Serializable;
  import java.util.HashMap;
  import java.util.Map;
  import java.util.UUID;
  
  /**
   * Permission
   * <p>
   * Airbyte permission configuration
   *
   */
  @JsonInclude(JsonInclude.Include.NON_NULL)
  @JsonPropertyOrder({
    "permissionId",
    "permissionType",
    "userId",
    "workspaceId",
    "organizationId",
    "serviceAccountId"
  })
  @Generated(value = "Generated by jsonSchema2Pojo")
  public class Permission implements Serializable {
  
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("permissionId")
    private UUID permissionId;
    /**
     * PermissionType
     * <p>
     * Permission type enum describing the level of access granted by the permission object (Required)
     *
     */
    @JsonProperty("permissionType")
    @JsonPropertyDescription("Permission type enum describing the level of access granted by the permission object")
    private PermissionType permissionType;
    @JsonProperty("userId")
    private UUID userId;
    @JsonProperty("workspaceId")
    private UUID workspaceId;
    @JsonProperty("organizationId")
    private UUID organizationId;
    @JsonProperty("serviceAccountId")
    private UUID serviceAccountId;
    private final static long serialVersionUID = -1382855757141512537L;
  
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("permissionId")
    public UUID getPermissionId() {
      return permissionId;
    }
  
    /**
     *
     * (Required)
     *
     */
    @JsonProperty("permissionId")
    public void setPermissionId(UUID permissionId) {
      this.permissionId = permissionId;
    }
  
    public Permission withPermissionId(UUID permissionId) {
      this.permissionId = permissionId;
      return this;
    }
  
    /**
     * PermissionType
     * <p>
     * Permission type enum describing the level of access granted by the permission object (Required)
     *
     */
    @JsonProperty("permissionType")
    public PermissionType getPermissionType() {
      return permissionType;
    }
  
    /**
     * PermissionType
     * <p>
     * Permission type enum describing the level of access granted by the permission object (Required)
     *
     */
    @JsonProperty("permissionType")
    public void setPermissionType(PermissionType permissionType) {
      this.permissionType = permissionType;
    }
  
    public Permission withPermissionType(PermissionType permissionType) {
      this.permissionType = permissionType;
      return this;
    }
  
    @JsonProperty("userId")
    public UUID getUserId() {
      return userId;
    }
  
    @JsonProperty("userId")
    public void setUserId(UUID userId) {
      this.userId = userId;
    }
  
    public Permission withUserId(UUID userId) {
      this.userId = userId;
      return this;
    }
  
    @JsonProperty("workspaceId")
    public UUID getWorkspaceId() {
      return workspaceId;
    }
  
    @JsonProperty("workspaceId")
    public void setWorkspaceId(UUID workspaceId) {
      this.workspaceId = workspaceId;
    }
  
    public Permission withWorkspaceId(UUID workspaceId) {
      this.workspaceId = workspaceId;
      return this;
    }
  
    @JsonProperty("organizationId")
    public UUID getOrganizationId() {
      return organizationId;
    }
  
    @JsonProperty("organizationId")
    public void setOrganizationId(UUID organizationId) {
      this.organizationId = organizationId;
    }
  
    public Permission withOrganizationId(UUID organizationId) {
      this.organizationId = organizationId;
      return this;
    }
  
    @JsonProperty("serviceAccountId")
    public UUID getServiceAccountId() {
      return serviceAccountId;
    }
  
    @JsonProperty("serviceAccountId")
    public void setServiceAccountId(UUID serviceAccountId) {
      this.serviceAccountId = serviceAccountId;
    }
  
    public Permission withServiceAccountId(UUID serviceAccountId) {
      this.serviceAccountId = serviceAccountId;
      return this;
    }
  
    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder();
      sb.append(Permission.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
      sb.append("permissionId");
      sb.append('=');
      sb.append(((this.permissionId == null) ? "<null>" : this.permissionId));
      sb.append(',');
      sb.append("permissionType");
      sb.append('=');
      sb.append(((this.permissionType == null) ? "<null>" : this.permissionType));
      sb.append(',');
      sb.append("userId");
      sb.append('=');
      sb.append(((this.userId == null) ? "<null>" : this.userId));
      sb.append(',');
      sb.append("workspaceId");
      sb.append('=');
      sb.append(((this.workspaceId == null) ? "<null>" : this.workspaceId));
      sb.append(',');
      sb.append("organizationId");
      sb.append('=');
      sb.append(((this.organizationId == null) ? "<null>" : this.organizationId));
      sb.append(',');
      sb.append("serviceAccountId");
      sb.append('=');
      sb.append(((this.serviceAccountId == null) ? "<null>" : this.serviceAccountId));
      sb.append(',');
      if (sb.charAt((sb.length() - 1)) == ',') {
        sb.setCharAt((sb.length() - 1), ']');
      } else {
        sb.append(']');
      }
      return sb.toString();
    }
  
    @Override
    public int hashCode() {
      int result = 1;
      result = ((result * 31) + ((this.organizationId == null) ? 0 : this.organizationId.hashCode()));
      result = ((result * 31) + ((this.serviceAccountId == null) ? 0 : this.serviceAccountId.hashCode()));
      result = ((result * 31) + ((this.permissionId == null) ? 0 : this.permissionId.hashCode()));
      result = ((result * 31) + ((this.permissionType == null) ? 0 : this.permissionType.hashCode()));
      result = ((result * 31) + ((this.userId == null) ? 0 : this.userId.hashCode()));
      result = ((result * 31) + ((this.workspaceId == null) ? 0 : this.workspaceId.hashCode()));
      return result;
    }
  
    @Override
    public boolean equals(Object other) {
      if (other == this) {
        return true;
      }
      if ((other instanceof Permission) == false) {
        return false;
      }
      Permission rhs = ((Permission) other);
      return (((((((this.organizationId == rhs.organizationId) || ((this.organizationId != null) && this.organizationId.equals(rhs.organizationId)))
          && ((this.serviceAccountId == rhs.serviceAccountId)
              || ((this.serviceAccountId != null) && this.serviceAccountId.equals(rhs.serviceAccountId))))
          && ((this.permissionId == rhs.permissionId) || ((this.permissionId != null) && this.permissionId.equals(rhs.permissionId))))
          && ((this.permissionType == rhs.permissionType) || ((this.permissionType != null) && this.permissionType.equals(rhs.permissionType))))
          && ((this.userId == rhs.userId) || ((this.userId != null) && this.userId.equals(rhs.userId))))
          && ((this.workspaceId == rhs.workspaceId) || ((this.workspaceId != null) && this.workspaceId.equals(rhs.workspaceId))));
    }
  
    /**
     * PermissionType
     * <p>
     * Permission type enum describing the level of access granted by the permission object
     *
     */
    public enum PermissionType {
  
      INSTANCE_ADMIN("instance_admin"),
      ORGANIZATION_ADMIN("organization_admin"),
      ORGANIZATION_EDITOR("organization_editor"),
      ORGANIZATION_RUNNER("organization_runner"),
      ORGANIZATION_READER("organization_reader"),
      ORGANIZATION_MEMBER("organization_member"),
      WORKSPACE_ADMIN("workspace_admin"),
      WORKSPACE_OWNER("workspace_owner"),
      WORKSPACE_EDITOR("workspace_editor"),
      WORKSPACE_RUNNER("workspace_runner"),
      WORKSPACE_READER("workspace_reader"),
      DATAPLANE("dataplane");
  
      private final String value;
      private final static Map<String, PermissionType> CONSTANTS = new HashMap<String, PermissionType>();
  
      static {
        for (PermissionType c : values()) {
          CONSTANTS.put(c.value, c);
        }
      }
  
      private PermissionType(String value) {
        this.value = value;
      }
  
      @Override
      public String toString() {
        return this.value;
      }
  
      @JsonValue
      public String value() {
        return this.value;
      }
  
      @JsonCreator
      public static PermissionType fromValue(String value) {
        PermissionType constant = CONSTANTS.get(value);
        if (constant == null) {
          throw new IllegalArgumentException(value);
        } else {
          return constant;
        }
      }
  
    }
  
  }
  