class DefaultSwaption {

  public double price(final CDSAnalytic forwardStartingCDS, final ISDACompliantYieldCurve yieldCurve, final ISDACompliantCreditCurve creditCurve, final double strike, final double optionExpiry,
      final double vol, final boolean isPayer, final boolean hasFrontEndProt) {

    ArgumentChecker.isTrue(forwardStartingCDS.getEffectiveProtectionStart() >= optionExpiry,
        "Have not provided a forward CDS. The option expiry is {}, but the CDS(effective) protection start time is {}", optionExpiry, forwardStartingCDS.getEffectiveProtectionStart());

    //front end protection is worth zero for an option to be the seller of protection 
    final double fep = isPayer && hasFrontEndProt ? forwardStartingCDS.getLGD() * yieldCurve.getDiscountFactor(optionExpiry) * (1 - creditCurve.getSurvivalProbability(optionExpiry)) : 0.0;
    final double annuity = _pricer.annuity(forwardStartingCDS, yieldCurve, creditCurve, PriceType.CLEAN, 0);
    final double protLeg = _pricer.protectionLeg(forwardStartingCDS, yieldCurve, creditCurve, 0);
    final double fwdSpread = protLeg / annuity;
    final double koVal = annuity * BlackFormulaRepository.price(fwdSpread, strike, optionExpiry, vol, isPayer);
    return koVal + fep;
  }

}