package com.cloudhandson.vpdbackoffice.domain.protectedobject;

public record ProtectedObject(
    long objectId,
    String owner,
    String objectName,
    String ordsPath,
    String enabledYn,
    String description
) {

  public ProtectedObject(long objectId, String owner, String objectName, String ordsPath, String enabledYn) {
    this(objectId, owner, objectName, ordsPath, enabledYn, null);
  }

  public boolean enabled() {
    return "Y".equalsIgnoreCase(enabledYn);
  }

  public String displayName() {
    return owner + "." + objectName;
  }

  public String descriptionOrDefault() {
    return description == null || description.isBlank()
        ? "등록된 DB 객체를 권한체계와 ORDS로 조회하는 대상"
        : description;
  }
}
