package hep.aida.ref.plotter;

import hep.aida.IAxisStyle;
import hep.aida.ILineStyle;
import hep.aida.ITextStyle;
import hep.aida.ref.plotter.BaseStyle;
import hep.aida.ref.plotter.LineStyle;
import hep.aida.ref.plotter.Style;
import hep.aida.ref.plotter.TextStyle;

/**
 *
 * @author The AIDA team @ SLAC.
 *
 */
public class AxisStyle extends BaseStyle implements IAxisStyle {
    
    private ITextStyle labelStyle;
    private ITextStyle tickStyle;
    private ILineStyle lineStyle;
    
    private static String labelPar = Style.AXIS_LABEL;
    private static String scalePar = Style.AXIS_SCALE;
    private static String typePar  = Style.AXIS_TYPE;
    
    protected void initializeBaseStyle() {
        labelStyle = new TextStyle();
        tickStyle  = new TextStyle();
        lineStyle  = new LineStyle();
        String[] scaleOptions = {"lin", "linear", "log", "logarithmic"};
        addParameter(scalePar, scaleOptions);
        String[] typeOptions = {"double", "int", "date", "string"};
        addParameter(typePar, typeOptions);
        addParameter(labelPar);
        String[] trueFalse = {"true", "false"};
        addParameter("allowZeroSuppression", trueFalse, "true");
        String[] yAxisValues = {"Y0", "Y1"};
        addParameter("yAxis", yAxisValues, "Y0");
        addBaseStyle( labelStyle, "label" );
        addBaseStyle( tickStyle, "tick" );
        addBaseStyle( lineStyle, "line" );
    }
    
    public void setLabel(String label) {
        setParameter( labelPar, label );
    }
    
    public String label() {
        return parameterValue( labelPar );
    }

    public ITextStyle labelStyle() {
        return labelStyle;
    }
    
    public ILineStyle lineStyle() {
        return lineStyle;
    }
    
    public ITextStyle tickLabelStyle() {
        return tickStyle;
    }
    
    public boolean setLabelStyle(ITextStyle labelStyle) {
        this.labelStyle = labelStyle;
        addBaseStyle( labelStyle, "label" );
        return true;
    }
    
    public boolean setTickLabelStyle(ITextStyle tickLabelStyle) {
        this.tickStyle = tickLabelStyle;
        addBaseStyle( tickStyle, "tick" );
        return true;
    }
    
    public boolean setlineStyle(ILineStyle lineStyle) {
        this.lineStyle = lineStyle;
        addBaseStyle( lineStyle, "line" );
        return true;
    }
    
}
