package gov.cms.grouper.snf.r3;


import gov.cms.grouper.snf.SnfComponentVersion;
import gov.cms.grouper.snf.model.enums.ObraAssessment;
import gov.cms.grouper.snf.model.enums.PpsAssessment;

public class SnfComponent extends gov.cms.grouper.snf.r2.SnfComponent {
  public SnfComponent() {
    this(105);
  }
  public SnfComponent(int dataVersion) {
    super(dataVersion);
    if (dataVersion < SnfComponentVersion.r3.getFrom()
            && dataVersion > SnfComponentVersion.r3.getTo()) {
      throw new RuntimeException("Version mismatch");
    }
  }


  @Override
  public Boolean isInterimPayment(PpsAssessment ppsValue, ObraAssessment obraValue) {
    // Introduction of Obra
    // OBRA assessment do not have Interim Payment Assessments (IPA)
    // If this is standalone obra
    if (obraValue != null && obraValue != ObraAssessment.NONE
            && (ppsValue == null || ppsValue == PpsAssessment.NONE)) {
      return false;
    } else {
      return super.isInterimPayment(ppsValue, obraValue);
    }
  }


}
