/*-
 * ============LICENSE_START=======================================================
 * SDC
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * 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.
 * ============LICENSE_END=========================================================
 */

import UUID from 'uuid-js';

let toCustomUUID = (uuid) => {
	return 'U' + uuid.replace(/-/g, '');
};

let getUUID = function(num, isSync) {
	if (isSync) {
		let uuid;
		if (!num) {
			uuid = toCustomUUID(UUID.create().toString());
		} else {
			uuid = [];
			for (var i = 0; i < num; i++) {
				uuid[i] = toCustomUUID(UUID.create().toString());
			}
		}
		if (num === 1) {
			return uuid[0];
		} else {
			return uuid;
		}
	}
	return new Promise(resolve => {
		let uuid;
		if (!num) {
			uuid = toCustomUUID(UUID.create().toString());
		} else {
			uuid = [];
			for (var i = 0; i < num; i++) {
				uuid[i] = toCustomUUID(UUID.create().toString());
			}
		}
		setTimeout(() => resolve(uuid), 100);
	});
};

export default getUUID;
