/*-
 * ~~~~~~licensing~~~~~~
 * artifact-management
 * ==========
 * Copyright (C) 2020 - 2021 EmDev LLC
 * ==========
 * 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.
 * ~~~~~~/licensing~~~~~~
 */
package ru.entaxy.platform.core.artifact;

import java.io.File;
import java.util.Map;

import ru.entaxy.platform.core.artifact.capabilities.CapabilityDescriptor;

public interface Artifact {

	public static final String ARTIFACT_CATEGORY_UNKNOWN = "unknown";
	
	public static final String ARTIFACT_CATEGORY_BLUEPRINT = "blueprint";
	public static final String ARTIFACT_CATEGORY_BUNDLE = "bundle";
	public static final String ARTIFACT_CATEGORY_JAR = "jar";
	
	public static final String ARTIFACT_CATEGORY_CONFIG = "config";
	public static final String ARTIFACT_CATEGORY_FEATURES = "features";
	
	public static final String DEFAULT_RUNTIME_GROUP_ID = "entaxy.runtime";
	
	public String getCategory();
	
	public ArtifactCoordinates getCoordinates();

	public Object getContent();
	
	// TODO add 'throws' declaration if needed  
	public void setContent(Object content);
	
	public void toFile(File destination);
	
	public byte[] asByteArray();
	
	public Map<String, Object> getProperties();
	
	// capabilities support
	
	@Deprecated(forRemoval = true, since = "1.8.2")
	public CapabilityDescriptor provideCapability(String namespace);
	
	@Deprecated(forRemoval = true, since = "1.8.2")
	public CapabilityDescriptor requireCapability(String namespace);
	
	public default boolean isManifested() {
		return Manifested.class.isAssignableFrom(this.getClass());
	}
}
