/*-
 * ~~~~~~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.core.producer.wrapper;

import com.google.gson.JsonObject;

import ru.entaxy.platform.base.objects.factory.EntaxyFactory.FieldInfo;

public class FieldWrapper implements FieldInfo {

	protected FieldInfo origin;
	
	public FieldWrapper(FieldInfo origin) {
		this.origin = origin;
	}

	@Override
	public String getName() {
		return origin.getName();
	}

	@Override
	public String getType() {
		return origin.getType();
	}

	@Override
	public String getDisplayName() {
		return origin.getDisplayName();
	}

	@Override
	public String getDescription() {
		return origin.getDescription();
	}

	@Override
	public boolean isImmutable() {
		return origin.isImmutable();
	}

	@Override
	public boolean isRequired() {
		return origin.isRequired();
	}

	@Override
	public Object getDefaultValue() {
		return origin.getDefaultValue();
	}

	@Override
	public boolean isConditional() {
		return origin.isConditional();
	}

	@Override
	public String getCondition() {
		return origin.getCondition();
	}

	@Override
	public boolean isRef() {
		return origin.isRef();
	}

	@Override
	public JsonObject getJsonOrigin() {
		try {
			return origin.getJsonOrigin().deepCopy();
		} catch (Exception e) {
			return new JsonObject();
		}
	}
	
	
}
