package com.oguerreiro.resilient.service.dto.security;

import com.oguerreiro.resilient.security.resillient.SecurityPermission;
import com.oguerreiro.resilient.security.resillient.SecurityResourceType;
import com.oguerreiro.resilient.service.dto.AbstractResilientDTO;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;

/**
 * A DTO for the {@link com.oguerreiro.resilient.security.SecurityResource} entity.
 */
@Schema(description = "SecurityResource")
public class SecurityResourceDTO extends AbstractResilientDTO<Long> {

  private static final long serialVersionUID = 1L;

  @NotNull
  private String code;

  private String name;

  @NotNull
  private SecurityResourceType type;

  @NotNull
  private SecurityPermission defaultCreatePermission;

  @NotNull
  private SecurityPermission defaultReadPermission;

  @NotNull
  private SecurityPermission defaultUpdatePermission;

  @NotNull
  private SecurityPermission defaultDeletePermission;

  public String getCode() {
    return code;
  }

  public void setCode(String code) {
    this.code = code;
  }

  public String getName() {
    return name;
  }

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

  public SecurityResourceType getType() {
    return type;
  }

  public void setType(SecurityResourceType type) {
    this.type = type;
  }

  public SecurityPermission getDefaultCreatePermission() {
    return defaultCreatePermission;
  }

  public void setDefaultCreatePermission(SecurityPermission defaultCreatePermission) {
    this.defaultCreatePermission = defaultCreatePermission;
  }

  public SecurityPermission getDefaultReadPermission() {
    return defaultReadPermission;
  }

  public void setDefaultReadPermission(SecurityPermission defaultReadPermission) {
    this.defaultReadPermission = defaultReadPermission;
  }

  public SecurityPermission getDefaultUpdatePermission() {
    return defaultUpdatePermission;
  }

  public void setDefaultUpdatePermission(SecurityPermission defaultUpdatePermission) {
    this.defaultUpdatePermission = defaultUpdatePermission;
  }

  public SecurityPermission getDefaultDeletePermission() {
    return defaultDeletePermission;
  }

  public void setDefaultDeletePermission(SecurityPermission defaultDeletePermission) {
    this.defaultDeletePermission = defaultDeletePermission;
  }

  //@formatter:off
  @Override
  public String toString() {
    return "SecurityResourceDTO{" + 
              "id=" + getId() + 
              ", code='" + getCode() + "'" + 
              ", name='" + getName() + "'" + 
              ", defaultCreatePermission='" + getDefaultCreatePermission() + "'" + 
              ", defaultReadPermission='" + getDefaultReadPermission() + "'" +
              ", defaultUpdatePermission='" + getDefaultUpdatePermission() + "'" +
              ", defaultDeletePermission='" + getDefaultDeletePermission() + "'" +
              ", version=" + getVersion() + 
           "}";
  }
//@formatter:on
}
