import packNugetModule from '@microsoft/windows-admin-center-sdk/tools/pack-nuget';
import { Utilities } from './utilities';

interface PackOptions {
    version: string;
    icon: string;
    license: string;
    company: string;
    copyright: string;
    iconUrl: string;
    targetPath: string;
}

export module PackModule {
    const argv = Utilities.gulpArgv();

    const packNuget = packNugetModule as any;

    export function pack(cb) {
        const options = <PackOptions>{};
        if (argv['version']) {
            options.version = argv['version'] as string;
        }

        if (argv['icon']) {
            options.icon = argv['icon'] as string;
        }

        if (argv['license']) {
            options.license = argv['license'] as string;
        }

        if (argv['company']) {
            options.company = argv['company'] as string;
        }

        if (argv['copyright']) {
            options.copyright = argv['copyright'] as string;
        }

        if (argv['iconUrl']) {
            options.iconUrl = argv['iconUrl'] as string;
        }

        if (argv['targetPath']) {
            options.targetPath = argv['targetPath'] as string;
        }

        packNuget(options, cb);
    }
}
