package exports;

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

import java.io.Writer;

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.datastore.SimulationStorage;
import fr.ifremer.isisfish.datastore.ResultStorage;

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

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

    /** to use log facility, just put in your code: log.info("..."); */
    static private Log log = LogFactory.getLog(RegionDefinition.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 "RegionDefinition";
    }
    
    public String getExtensionFilename() {
        return ".csv";
    }
    
    public String getDescription() {
        return _("Export region description");
    }

    public void export(SimulationStorage simulation, Writer out) throws Exception {
        // NomRegion LatituteMin LatitudeMax LongitudeMin LongitudeMax PasLatitude PasLongitude
        FisheryRegion region = simulation.getFisheryRegion();
        out.write(region.getName() + ";"
                + region.getMinLatitude() + ";"
                + region.getMaxLatitude() + ";" 
                + region.getMinLongitude() + ";" 
                + region.getMaxLongitude() + ";"
                + region.getCellLengthLatitude() + ";" 
                + region.getCellLengthLongitude() +
                "\n");
    }

}
