package exports;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.Writer;
import java.util.List;

import static org.codelutin.i18n.I18n._;
import org.codelutin.math.matrix.*;

import fr.ifremer.isisfish.entities.*;
import fr.ifremer.isisfish.export.Export;
import fr.ifremer.isisfish.types.Date;
import fr.ifremer.isisfish.datastore.SimulationStorage;
import fr.ifremer.isisfish.datastore.ResultStorage;

import fr.ifremer.isisfish.util.Doc; // pour pouvoir afficher une aide contextuelle (BUG#1605)

/**
 * CellsDefinition.java
 *
 * Created: 17 janvier 2007
 *
 * @author bpoussin <bpoussin@labs.libre-entreprise.org>
 * @version $Revision: 1.2 $
 *
 * Last update: $Date: 2007-05-24 09:30:07 $
 * by : $Author: bpoussin $
 */
 @Doc(value="do the doc of class CellsDefinition")
public class CellsDefinition implements Export {

    /** to use log facility, just put in your code: log.info("..."); */
    static private Log log = LogFactory.getLog(CellsDefinition.class);

    public String [] necessaryResult = {
    // put here all necessary result for this rule
    // example: 
    // ResultName.MATRIX_BIOMASS,
    // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET,
    };

    public String[] getNecessaryResult() {
        return this.necessaryResult;
    }

    public String getExportFilename() {
        return "MailleDefinition";
    }
    
    public String getExtensionFilename() {
        return ".csv";
    }
    
    public String getDescription() {
        return _("Export cell's position(longitute/latitute)");
    }

    public void export(SimulationStorage simulation, Writer out) throws Exception {
        List<Cell> cells = simulation.getFisheryRegion().getCell();
        
        for (Cell cell : cells) {
            out.write(cell + ";" + cell.getLongitude() + ";" + cell.getLatitude() + "\n");
        }
    }

}
