/*
 *  Copyright (C) 2010 Lari Natri <lari.natri@gmail.com>
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 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
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package compid.report.exporters;

import net.aavalla.utils.jobpool.parameters.FieldAnnotations;
import net.aavalla.utils.jobpool.parameters.OutputFile;
import net.aavalla.utils.jobpool.parameters.validators.OutputFileValidator;

/**
 *
 * @author Lari Natri <lari.natri@gmail.com>
 */
public class CsvExporter extends Exporter {
    
    public class CsvExporterParams extends ExporterParams {
        @FieldAnnotations(name="Output file",
            description="Text file",
            validator=OutputFileValidator.class)
        private OutputFile outputFile = null;
        
        @FieldAnnotations(name="Include table headers",
            description="If selected, includes page titles")
        private boolean headers = true;        
        
        @FieldAnnotations(name="Include column names",
            description="If selected, column names will be written as ordinary rows<br/>" +
            " in the beginning of each table")
        private boolean columnNames = true;
        
        @FieldAnnotations(name="Table start/end lines only in-between",
            description="If selected, table start and end lines are only written<br/>" +
            "in between tables as in not before the first or after the last table")
        private boolean tableStartEndsOnlyBetween = false;        
        
        @FieldAnnotations(name="Header line start",
            description="Added in the beginning of each header (titles) line")                
        private String preHeader = "%";

        @FieldAnnotations(name="Table start line",
            description="Line to add before each table")                        
        private String tableStartLine = "";
        
        @FieldAnnotations(name="Table start line",
            description="Line to add after each table")                                
        private String tableEndLine = "";
        
        @FieldAnnotations(name="Row start",
            description="String to add before each table row")        
        private String rowStart = "";       
        
        @FieldAnnotations(name="Column separator",
            description="Separator string to insert between table columns")
        private String colSeparator = "&";
        
        @FieldAnnotations(name="Row end",
            description="String to add to each table row's end")        
        private String rowEnd = "\\\\";

        public CsvExporterParams() {
            this.setDescription("Exports report to a text file");
        }
    }

    @Override
    protected Object work(ExporterParams params) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    protected ExporterParams getNonfinalEditableParameters() {
        return new CsvExporterParams();
    }



}
