package com.oguerreiro.resilient.error;

import com.oguerreiro.resilient.repository.ResilientJpaRepository;

/**
 * Exception used in {@link ResilientJpaRepository} interface, for conceptual(default) methods that specific
 * implementation
 * should (re)define.
 */
public class ResilientJpaMethodNotImplementedRuntimeException extends ResilientRuntimeException {
  private static final long serialVersionUID = 1L;
  private static final String CODE = "E017";

  public ResilientJpaMethodNotImplementedRuntimeException(String jpaRepositoryClassName,
      String jpaRepositoryMethodName) {
    super(
        "Resilient JPA method not implemented. Entity JPA interfaces must provide custom eager loading methods. See documentation for "
            + jpaRepositoryClassName + "." + jpaRepositoryMethodName + ".");

    addMessageArg(jpaRepositoryClassName);
    addMessageArg(jpaRepositoryMethodName);
  }

  @Override
  public String getMessageCode() {
    return CODE;
  }

}
