class PasswordCredentialVersion extends CredentialVersion {

  public void setPasswordAndGenerationParameters(
    final String password,
    final StringGenerationParameters generationParameters
  ) {
    if (password == null) {
      throw new IllegalArgumentException("password cannot be null");
    }

    try {
      final String generationParameterJson = generationParameters != null ? jsonObjectMapper.writeValueAsString(generationParameters) : null;

      if (generationParameterJson != null) {
        final EncryptedValue encryptedParameters = getEncryptor().encrypt(generationParameterJson);
        delegate.setEncryptedGenerationParameters(encryptedParameters);
      }

      final EncryptedValue encryptedPassword = getEncryptor().encrypt(password);
      delegate.setEncryptedValueData(encryptedPassword);
    } catch (final Exception e) {
      throw new RuntimeException(e);
    }
  }

  public  PasswordCredentialVersion(final PasswordCredentialVersionData delegate);
  public  PasswordCredentialVersion(final String name);
  public  PasswordCredentialVersion();
  public  PasswordCredentialVersion(
    final StringCredentialValue password,
    final StringGenerationParameters generationParameters,
    final Encryptor encryptor
  );

}