package event.editor;
import images.*;
import java.awt.Graphics;
import javax.swing.ImageIcon;
import java.net.URL;
import java.awt.Image;
import java.awt.image.BufferedImage;

public enum Properties
{
    ATMS                ("ATMS", PropertyTypes.Optional,
        loadImage(Images.getImage("ATMSEval.png"))),
    ActivityLog         ("Activity Log", PropertyTypes.Optional,
        loadImage(Images.getImage("ActivityLogEval.png"))),
    CAD                 ("CAD", PropertyTypes.Optional,
        loadImage(Images.getImage("CADEval.png"))),
    Facilitator         ("Faciliatator", PropertyTypes.Optional,
        loadImage(Images.getImage("FacilitatorEval.png"))),
    Radio               ("Radio", PropertyTypes.Optional,
        loadImage(Images.getImage("RadioEval.png"))),
    MaintenanceRadio    ("Maintenance Radio", PropertyTypes.Optional,
        loadImage(Images.getImage("MaintenanceRadio.png"))),
    TMTRadio            ("TMT Radio", PropertyTypes.Optional,
        loadImage(Images.getImage("TMTRadio.png"))),
    Telephone           ("Telephone", PropertyTypes.Optional,
        loadImage(Images.getImage("Telephone.png"))),
    CHPRadio            ("CHP Radio",PropertyTypes.Optional,
        loadImage(Images.getImage("CHPRadio.png"))),
    CMS                 ("CMS", PropertyTypes.Multiple,
        loadImage(Images.getImage("CMSEval.png"))),
    Audio               ("Audio", PropertyTypes.Multiple,
        loadImage(Images.getImage("Audio.png"))),
    CCTV                ("CCTV", PropertyTypes.Multiple,
        loadImage(Images.getImage("CCTV.png"))),
    CADLog              ("CAD Log", PropertyTypes.Multiple,
        loadImage(Images.getImage("CAD.png"))),
    Paramics            ("Paramics", PropertyTypes.Multiple,
        loadImage(Images.getImage("Paramics.png"))),
    Tow                 ("Tow", PropertyTypes.Multiple,
        loadImage(Images.getImage("Tow.png"))),
    Unit                ("Unit", PropertyTypes.Multiple,
        loadImage(Images.getImage("Unit.png"))),
    Witness             ("Witness", PropertyTypes.Multiple,
        loadImage(Images.getImage("Witness.png")));

    private String title;
    private PropertyTypes type;
    private ImageIcon image;

    private Properties(String theTitle, PropertyTypes theType, ImageIcon theImage)
    {
        title = theTitle;
        type = theType;
        image = theImage;
    }

    public String getTitle()
    {
        return title;
    }

    public PropertyTypes getType()
    {
        return type;
    }

    public ImageIcon getImage()
    {
        return image;
    }

    private static ImageIcon loadImage(URL url)
    {
        double scale = 0.8;
        ImageIcon icon = new ImageIcon(url);
        Image img = icon.getImage();
        BufferedImage bi = new BufferedImage(img.getWidth(null),
                img.getHeight(null), BufferedImage.TYPE_INT_ARGB);
        Graphics g = bi.createGraphics();
        g.drawImage(img, 0, 0, (int) (img.getWidth(null) * scale), (int)(img.getHeight(null) * scale), null);
        return new ImageIcon(bi);
    }
}