package turgen.plugin;

import javax.swing.*;
import turgen.playlist.AbstractPlayListItem;
import turgen.tapeimage.TapeImageChunk;

public interface Plugin {
    
    
    /** Get human readable plugin name
     * @return Plugin name*/
    public String getName();
    
    /** Convert a playlist item
     @param plr Playlist item
     * @return Array of SignalGenerator instructions
     * @throws java.lang.Exception
     */
    public int[] convertItem(AbstractPlayListItem plr) throws Exception;
    
    /**Initialize plugin*/
    public void init();
    
    /**Get panel to edit playlist items
     * @return JPanel that will be used to edit a playlist item
     */
    public JPanel getItemPanel();
    
    /**Validate data specified in the panel
     * 
     * @return An error message if a playlist item is invalid or null when a playlist item is OK.
     */
    public String validateItemOnPanel();
    
    /**Clear playlist item panel*/
    public void resetPanel();
    
    /**Get playlist item from the panel
     *@return Polozka playlistu
     */
    public AbstractPlayListItem getItemFromPanel();
    
    /**Fill panel using given playlist item
     * 
     * @param plr Playlist item
     */
    public void fillPanel(AbstractPlayListItem plr);
        
    /**
     * Set reference to provider of input and output file
     * Implementations should keep the reference
     * @param prov Provider of the input and the output file
     */
    public void setInOutProvider(InOutProvider prov);

    /**Return array of tape image chunk names (parent or standalone) supported
     * by the plugin
     * @return Array of tape image chunk names
     */
    public String[] getSupportedTapeImageChunks();

    /**Add SignalGenerator instructions for given tape image chunk to an instruction stream
     * @param is Instruction stream
     * @param chunk Tape image chunk
     * @throws java.lang.Exception
     */
    public void addInstructionsForChunk(InstructionStream is,TapeImageChunk chunk) throws Exception;

    /**Get array of binary convertors provided by the plugin
     * @return Array of BinaryConvertor implementations
     */
    public BinaryConvertor[] getBinaryConvertors();

    /**Get country from which originates a turbo system supported by the plugin
     * @return Country (PL - Poland, CS - Former Czechoslovakia, other - no country)
     */
    public String getCountry();
    
    /** Determines if the plugin uses alternate file chooser
     * @return true when the plugin ises an alternate set of file choosers, false when not*/
    public boolean isUsingAlternateFileChooser();
    
    
}
