#!/bin/bash

source /var/onap/sdnc
source /var/onap/functions

appc_src_folder=$git_src_folder/appc
appc_repos=("appc" "appc/deployment")

# clone_all_appc_repos() - Function that clones APPC source repo.
function clone_all_appc_repos {
    for repo in ${appc_repos[@]}; do
        clone_repo $repo $appc_src_folder${repo#*appc}
    done
}

# compile_all_appc_repos() - Function that compiles APPC source repo.
function compile_all_appc_repos {
    for repo in ${appc_repos[@]}; do
        compile_src $appc_src_folder${repo#*appc}
    done
}

# _build_appc_images() - Function that creates APPC images from source code.
function _build_appc_images {
    get_sdnc_images
    build_docker_image $appc_src_folder/deployment/installation/appc docker
}

# get_appc_images() - Function that gets or build APPC docker images
function get_appc_images {
    if [[ "$build_image" == "True" ]]; then
        _build_appc_images
    else
        pull_openecomp_image appc-image openecomp/appc-image:latest
        pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest
    fi
}

# install_appc() - Function that clones and installs the APPC services from source code
function install_appc {
    pushd $appc_src_folder/deployment/docker-compose
    install_docker_compose
    /opt/docker/docker-compose up -d
    popd
}

# init_appc() - Function that initialize APPC services
function init_appc {
    if [[ "$clone_repo" == "True" ]]; then
        clone_all_appc_repos
        if [[ "$compile_repo" == "True" ]]; then
            compile_all_appc_repos
        fi
    fi

    if [[ "$skip_get_images" == "False" ]]; then
        get_appc_images
        if [[ "$skip_install" == "False" ]]; then
            install_appc
        fi
    fi
}
