/*
 * This program was produced for the U.S. Agency for International Development. It was prepared by the USAID | DELIVER PROJECT, Task Order 4. It is part of a project which utilizes code originally licensed under the terms of the Mozilla Public License (MPL) v2 and therefore is licensed under MPL v2 or later.
 *
 * This program is free software: you can redistribute it and/or modify it under the terms of the Mozilla Public License as published by the Mozilla Foundation, either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public License for more details.
 *
 * You should have received a copy of the Mozilla Public License along with this program. If not, see http://www.mozilla.org/MPL/
 */

package org.openlmis.report.model.params;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.openlmis.core.domain.ProcessingPeriod;
import org.openlmis.report.model.ReportParameter;

import java.text.DateFormat;
import java.text.SimpleDateFormat;


@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper=false)
@AllArgsConstructor
public class RegimenSummaryReportParam
  extends BaseParam implements ReportParameter {

  private long period;
  private ProcessingPeriod periodObject;
  private int rgroupId;
  private int regimenCategoryId;
  private String regimenCategory;
  private String rgroup;
  private String regimen;
  private Integer regimenId;
  private int programId;
  private String program;
  private int scheduleId;
  private String schedule;
  private int periodId;
  private Integer year;


    @Override
    public String toString() {
        DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT);
        StringBuilder filtersValue = new StringBuilder("");
        //filtersValue.append("Period : ").append(this.period).append("\n").
        //append("Schedule : ").append(this.schedule).append("\n").
        //append("Program : ").append(this.program).append("\n").
        //append("Requisition Group : ").append(this.rgroup).append("\n");
        return filtersValue.toString();
    }

}

@@ -1183,37 +1183,8 @@
 r;%0A%0A
-import java.text.DateFormat;%0A
 impo
@@ -1269,17 +1269,19 @@
 allSuper
-=
+ = 
 false)%0A@
@@ -1338,16 +1338,22 @@
 rtParam%0A
+      
   extend
@@ -1396,16 +1396,18 @@
 er %7B%0A%0A  
+ 
+ 
 private 
@@ -1419,16 +1419,18 @@
 period;%0A
+  
   privat
@@ -1462,18 +1462,21 @@
 Object;%0A
+%0A 
   
+ 
 private 
@@ -1485,24 +1485,26 @@
 t rgroupId;%0A
+  
   private in
@@ -1520,24 +1520,26 @@
 CategoryId;%0A
+  
   private St
@@ -1558,24 +1558,26 @@
 Category;%0A  
+ 
+ 
 private Stri
@@ -1587,16 +1587,18 @@
 rgroup;%0A
+  
   privat
@@ -1615,16 +1615,18 @@
 egimen;%0A
+  
   privat
@@ -1642,24 +1642,26 @@
  regimenId;%0A
+  
   private in
@@ -1671,24 +1671,26 @@
 rogramId;%0A  
+ 
+ 
 private Stri
@@ -1699,24 +1699,26 @@
  program;%0A  
+ 
+ 
 private int 
@@ -1725,24 +1725,26 @@
 scheduleId;%0A
+  
   private St
@@ -1758,16 +1758,18 @@
 hedule;%0A
+  
   privat
@@ -1784,16 +1784,18 @@
 riodId;%0A
+  
   privat
@@ -1815,137 +1815,156 @@
 r;%0A%0A
-%0A    @Override%0A    public String toString() %7B%0A        DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT);%0A
+    SimpleDateFormat dateFormatter = new SimpleDateFormat();%0A%0A    @Override%0A    public String toString() %7B%0A        if (periodObject != null) %7B%0A%0A    
     
@@ -2027,18 +2027,20 @@
         
-//
+    
 filtersV
@@ -2075,45 +2075,354 @@
 end(
-this.period).append(%22%5Cn%22).%0A        //
+dateFormatter.format(this.periodObject.getNextStartDate())).append(%22-%22).append(dateFormatter.format(this.periodObject.getEndDate())).append(%22%5Cn%22).%0A                    append(%22Regimen Category : %22).append(this.getRegimenCategory()).append(%22%5Cn%22).%0A                    append(%22Regimen : %22).append(this.getRegimen()).append(%22%5Cn%22).%0A                    
 appe
@@ -2451,24 +2451,29 @@
 nd(this.
-s
+getS
 chedule
+()
 ).append
@@ -2480,34 +2480,44 @@
 (%22%5Cn%22).%0A        
+   
-//
+         
 append(%22Program 
@@ -2533,23 +2533,28 @@
 nd(this.
-p
+getP
 rogram
+()
 ).append
@@ -2569,18 +2569,28 @@
         
+   
-//
+         
 append(%22
@@ -2595,23 +2595,22 @@
 (%22Re
-quisition
+porting
  Group
+s
  : %22
@@ -2627,30 +2627,27 @@
 his.
-r
+getR
 group
-).append(%22%5Cn%22);%0A
+());%0A%0A    
     
@@ -2686,13 +2686,83 @@
 ();%0A    
-%7D
+    %7D else %7B%0A            return %22No filters selected%22;%0A        %7D%0A    %7D%0A
 %0A%0A%7D%0A

Add Back end code for Regimen Summary Report