/*
 * Copyright (C) SapphireCode - All Rights Reserved
 * This file is part of Snippeteer which is released under BSD-3-Clause.
 * See file 'LICENSE' for full license details.
 * Created by Timo Hocker <timo@scode.ovh>, April 2020
 */

import { CopyrightOptions } from './copyright_options';

export class CopyrightGenerator {
  public static get_copyright_notice (
    opt: CopyrightOptions
  ): string {
    let notice = '';
    const date = (new Date);
    const dtf = new Intl.DateTimeFormat ('en', { month: 'long' });
    const year = date.getFullYear ();
    const month = dtf.format (date);

    if (opt.has_license) {
      notice = `${'/*'}
 * Copyright (C) ${opt.company || opt.author} - All Rights Reserved
 * This file is part of ${opt.software} which is released under ${
  opt.license}.
 * See file 'LICENSE' for full license details.
 * Created by ${opt.author} <${opt.email}>, ${month} ${year}
 */

`;
    }
    else {
      notice = `${'/*'}
 * Copyright (C) ${opt.company || opt.author} - All Rights Reserved
 * Created by ${opt.author} <${opt.email}>, ${month} ${year}
 */

`;
    }
    return notice;
  }
}