package com.limegroup.gnutella.malware;

import java.util.Arrays;

/**
 * Defines the file extensions that are acceptable for a mime type that is
 * considered dangerous. Restricting dangerous files to certain extensions
 * prevents them from being renamed to bypass the list of banned extensions
 * (see FilterSettings.BANNED_EXTENSIONS).
 */
class DangerousFileType {

    final String mimeType;
    final String[] extensions;

    DangerousFileType(String mimeType, String[] extensions) {
        this.mimeType = mimeType;
        this.extensions = extensions;
    }

    @Override
    public boolean equals(Object o) {
        if(o instanceof DangerousFileType) {
            DangerousFileType d = (DangerousFileType)o;
            return mimeType.equals(d.mimeType) && Arrays.equals(extensions, d.extensions);
        }
        return false;
    }

    @Override
    public int hashCode() {
        return mimeType.hashCode();
    }
}
