/*-
 * ~~~~~~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.impl;

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

public class RefFieldInfoImpl extends FieldInfoImpl implements EntaxyFactory.RefFieldInfo{
	
	protected boolean isBackRef = false;
	protected boolean isRefByValueOnly = false;
	
	protected String refField = EntaxyObject.FIELDS.OBJECT_ID;
	
	/* EntaxyFactory.RefFieldInfo */
	
	@Override
	public boolean isBackRef() {
		return isBackRef;
	}

	@Override
	public boolean isRefByValueOnly() {
		return isRefByValueOnly;
	}

	@Override
	public String getRefField() {
		return refField;
	}

	/* builder */
	
	public RefFieldInfoImpl backRef(boolean backRefValue) {
		this.setBackRef(backRefValue);
		return this;
	};
	
	public RefFieldInfoImpl refByValueOnly(boolean refByValueOnlyValue) {
		this.setRefByValueOnly(refByValueOnlyValue);
		return this;
	};
	
	public RefFieldInfoImpl refField(String refFieldValue) {
		this.setRefField(refFieldValue);
		return this;
	};
	
	/* others */
	
	public void setBackRef(boolean isBackRef) {
		this.isBackRef = isBackRef;
	}

	public void setRefByValueOnly(boolean isRefByValueOnly) {
		this.isRefByValueOnly = isRefByValueOnly;
	}

	public void setRefField(String refField) {
		this.refField = refField;
	}

}
