/*
 * Copyright © 2016-2017 European Support Limited
 *
 * 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.
 */
const {Then, When} = require('cucumber');
const assert = require('assert');
const util = require('../cucumber-common/utils/Utils.js');


/**
 * @module VF
 * @description Creates a VF for this Item (does NOT work on localhost). will get the data for the item and then update the input
 * data for the VF call.
 * @exampleFile Example_VSP.feature
 * @step I want to create a VF for this Item
 **/
Then('I want to create a VF for this Item', function () {
	return util.request(this.context, 'GET', '/vendor-software-products/' + this.context.item.id + '/versions/' + this.context.item.versionId).then(result => {
		this.context.inputData = util.getJSONFromFile('resources/json/createVF.json');
		// start replacing stuff
		this.context.inputData.contactId = this.context.headers['catalog']["USER_ID"];
		this.context.inputData.categories[0].uniqueId = result.data.category;
		this.context.inputData.categories[0].subcategories[0].uniqueId = result.data.subCategory;
		this.context.inputData.description = result.data.description;
		this.context.inputData.name = result.data.name;
		this.context.inputData.tags[0] = result.data.name;
		this.context.inputData.vendorName = result.data.vendorName;
		this.context.inputData.csarUUID = this.context.item.id;
		return util.request(this.context, 'POST', '/catalog/resources', this.context.inputData, 'catalog');
	});
});

