/*
 * Copyright 2015 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.uberfire.workbench.type;

import jsinterop.annotations.JsType;
import org.uberfire.backend.vfs.Path;
import org.uberfire.workbench.category.Category;
import org.uberfire.workbench.category.Undefined;
import org.uberfire.workbench.diff.DiffMode;

/**
 * Definition of a Resource Type
 */
@JsType
public interface ResourceTypeDefinition {

    /**
     * A short name of the resource type
     * @return the short name
     */
    public String getShortName();

    /**
     * A description of the resource type
     * @return the description
     */
    public String getDescription();

    /**
     * Resource prefix
     * @return the prefix
     */
    public String getPrefix();

    /**
     * Resource suffix
     * @return the prefix
     */
    public String getSuffix();

    /**
     * Defines the resource priority in terms of resource resolution
     * @return the priority
     */
    public int getPriority();

    /**
     * A simple (and maybe not very accurate) wildcard pattern to search for
     * this type of resource.
     * This is only used in order to optimize index and search.
     * @return the wildcard pattern
     */
    public String getSimpleWildcardPattern();

    /**
     * Indicates if the current parameter path matched the current resource type
     * @return true if matches, otherwise false
     */
    boolean accept(final Path path);

    /**
     * Defines the category for each resource. If no category is defined, {@link Undefined} should be returned
     * @return the resource category
     */
    Category getCategory();

    /**
     * Defines how the diff of this resource type should be presented.
     * @return the resource diff mode
     */
    default DiffMode getDiffMode() {
        return DiffMode.TEXTUAL;
    }
}
