package eu.dnetlib.usagestats.sushilite;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

/**
 * Created by tsampikos on 31/10/2016.
 */
public class Customer {
    private String id = "";

    private final List<ReportItem> reportItems;

    public Customer(String id, List<ReportItem> reportItems) {
        this.id = id;
        this.reportItems = reportItems;
    }

    /*
    public Customer(String id, String beginDate, String endDate,
                    String repositoryIdentifier, String itemIdentifier, String itemDataType, String granularity, List<ReportItem> reportItems) {
        this.id = id;
        this.reportItems = reportItems;
        if (itemIdentifier != null && !itemIdentifier.equals("")){
            String[] split = itemIdentifier.split(":");
            //switch (split[0].toLowerCase()){
            //    case "oid": executeOid(itemIdentifier.replaceFirst(split[0] + ":",""), repositoryIdentifier, beginDate, endDate, granularity);
            //                break;
            //}
        }
    }

    public void execute(String id, String beginDate, String endDate,
                    String repositoryIdentifier, String itemIdentifier, String itemDataType, String granularity) {
        this.id = id;
        if (itemIdentifier != null && !itemIdentifier.equals("")){
            String[] split = itemIdentifier.split(":");
            //switch (split[0].toLowerCase()){
            //    case "oid": executeOid(itemIdentifier.replaceFirst(split[0] + ":",""), repositoryIdentifier, beginDate, endDate, granularity);
            //                break;
            //}
        }
    }
    */


    @JsonProperty("ID")
    public String getId() {
        return id;
    }

    @JsonProperty("ReportItems")
    public List<ReportItem> getReportItems() {
        if (!reportItems.isEmpty()) {
            return reportItems;
        }
        return null;
    }
}
