// Copyright 2019 The Nomulus Authors. 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.

{namespace registry.soy.reporting.spec11}

/**
 * Template for the content of the monthly spec11 email
 */
{template .monthlySpec11Email}
  {@param threats: list<map<string, string>>}
  {@param resources: list<string>}
  {@param registry: string}
  {@param replyToEmail: string}

  Dear registrar partner,

  <p>{$registry} previously notified you when the following domains managed by your
    registrar were flagged for potential security concerns.</p>

  <p>The following domains that you manage continue to be flagged by our analysis for potential
    security concerns. This may be because the registrants have not completed the requisite steps
    to mitigate the potential security abuse and/or have it reviewed and delisted.</p>

  {call .threatMatchTable}
    {param threats: $threats /}
  {/call}

  <p>Please work with the registrant to mitigate any security issues and have the
    domains delisted. If you believe that any of the domains were reported in error, or are still
    receiving reports for issues that have been remediated,
    please <a href="https://safebrowsing.google.com/safebrowsing/report_error/?hl=en">submit a
    request</a> to have the site reviewed.</p>

  {call .resourceList}
    {param resources: $resources /}
  {/call}

  <p>You will continue to receive a monthly summary of all domains managed by your registrar
    that remain on our lists of potential security threats. You will also receive a daily
    notice when any new domains are added to these lists.</p>

  <p>If you have any questions regarding this notice, please contact {$replyToEmail}.</p>
{/template}

/**
 * Template for the content of the daily spec11 email
 */
{template .dailySpec11Email}
  {@param threats: list<map<string, string>>}
  {@param resources: list<string>}
  {@param date: string}
  {@param registry: string}
  {@param replyToEmail: string}

  Dear registrar partner,

  <p>{$registry} conducts a daily analysis of all domains registered in its TLDs to
    identify potential security concerns. On {$date}, the following domains that your
    registrar manages were flagged for potential security concerns:</p>

  {call .threatMatchTable}
    {param threats: $threats /}
  {/call}

  <p><b>Please communicate these findings to the registrant and work with the
    registrant to mitigate any security issues and have the domains delisted.</b></p>

  {call .resourceList}
    {param resources: $resources /}
  {/call}

   <p>If you believe that any of the domains were reported in error, or are still receiving
   reports for issues that have been remediated,
   please <a href="https://safebrowsing.google.com/safebrowsing/report_error/?hl=en">submit
   a request</a> to have the site reviewed.</p>

  <p>You will continue to receive daily notices when new domains managed by your registrar
    are flagged for abuse, as well as a monthly summary of all of your domains under management
    that remain flagged for abuse.</p>

  <p>If you would like to change the email to which these notices are sent please update your
    abuse contact using your registrar portal account.</p>

  <p>If you have any questions regarding this notice, please contact {$replyToEmail}.</p>
{/template}

/**
 * Template for the list of potentially-useful resources
 */
{template .resourceList}
  {@param resources: list<string>}
  {if length($resources) > 0}
    Some helpful resources for getting off a blocked list include:
    <ul>
      {for $resource in $resources}
        <li>{$resource}</li>
      {/for}
    </ul>
  {/if}
{/template}

/**
 * Template for the table containing the threats themselves
 */
{template .threatMatchTable}
  {@param threats: list<map<string, string>>}
  <table>
    <tr>
      <th>Domain Name</th>
      <th>Threat Type</th>
    </tr>
    {for $threat in $threats}
      <tr>
        <td>{$threat['domainName']}</td>
        <td>{$threat['threatType']}</td>
      </tr>
    {/for}
  </table>
{/template}
