/*-
 * ~~~~~~licensing~~~~~~
 * test-producers
 * ==========
 * Copyright (C) 2020 - 2022 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.base.objects;

public interface EntaxyObject {
	
	public interface HEADERS {

		String MAIN_OBJECT = "Entaxy-Main-Object";
		String GENERATED_OBJECTS = "Entaxy-Generated-Object";
		// public static final String HEADER_MAIN_OBJECT_ID = "Entaxy-Main-Object-Id";
		// public static final String HEADER_MAIN_OBJECT_TYPE = "Entaxy-Main-Object-Type";
		// public static final String HEADER_MAIN_OBJECT_FACTORY_ID = "Entaxy-Main-Object-Factory";
		// public static final String HEADER_OBJECT_ID = "Entaxy-Generated-Object";
		// public static final String HEADER_OBJECT_TYPE = "Entaxy-Generated-Object-Type";
		String GENERATED_OBJECTS_CONFIG = "Entaxy-Generated-Object-Configuration";

	}
	
	public interface FIELDS {
		
		public static final String FACTORY_ID = "factoryId";
		public static final String SCOPE = "scope";
		
		public static final String OBJECT_ID = "objectId";
		public static final String OBJECT_TYPE = "type";
		
		public static final String IS_REF = "isRef";
		public static final String IS_BACK_REF = "isBackRef";
		public static final String IS_REF_BY_VALUE_ONLY = "isRefByValueOnly";
		public static final String REF_FIELD = "refField";
		
		public static final String DEFAULT_VALUE = "defaultValue";
		
		public static final String PROPERTIES = "properties";

		public static final String FIELDS_TO_PUBLISH = "##publish";
	}
	
	public interface OBJECT_TYPES {
		
		public static final String ENTAXY_RUNTIME_TYPE_PREFIX = "entaxy.runtime.";
		
		public static final String PROFILE = ENTAXY_RUNTIME_TYPE_PREFIX + "profile";
		public static final String CONNECTOR = ENTAXY_RUNTIME_TYPE_PREFIX + "connector";
		public static final String CONNECTION = ENTAXY_RUNTIME_TYPE_PREFIX + "connection";
		public static final String DEFAULT_ROUTE = ENTAXY_RUNTIME_TYPE_PREFIX + "default-route";
		
		public static boolean isRuntimeType(String typeName) {
			return (typeName!=null) && typeName.startsWith(ENTAXY_RUNTIME_TYPE_PREFIX); 
		}
		
	}

	public static interface BundleInfo {
		public long getBundleId();
	}
	
	public String getObjectId();
	public String getObjectType();
	public default String getObjectFullId() {
		return getObjectId() + ":" + getObjectType();
	};
	
	public String getFactoryId();
	public BundleInfo getBundleInfo();
	public String getConfiguration();
	
}
