from django.db import migrations, models


DEFAULT_WEEKLY_ITEM_TEMPLATE = '''<tr>
  <td height="40" style="height: 40px;">
    &nbsp;
  </td>
</tr>
<tr>
  <td width="100%" style="width:100%">
    <a href="{{article_url}}" target="_blank" rel="newsletter" style="text-decoration: none;">
      <p style="font-weight: 400; font-size: 24px; line-height: 29px; text-align: justify; color: #0E1B42;">
        {{article_title}}
      </p>
    </a>
  </td>
</tr>
<tr>
  <td height="20" style="height: 20px;">
    &nbsp;
  </td>
</tr>
<tr>
  <td>
    <table
      role="presentation"
      width="100%"
      height="333"
      cellspacing="0"
      cellpadding="0"
      border="0"
      style="width:100%; height:333px; border-collapse:collapse; border-spacing:0; margin:0; padding:0;"
    >
      <tbody>
        <tr>
          <td width="96" style="width: 96px; padding:0; margin:0; font-size:0; line-height:0;">&nbsp;</td>
          <td width="596" style="width: 596px; padding:0; margin:0; font-size:0; line-height:0;">
            <a href="{{article_url}}" target="_blank" rel="newsletter">
              <img src="{{article_cover_url}}" alt="{{article_title}}" style="width: 596px; height: 333px;">
            </a>
          </td>
          <td width="96" style="width: 96px; padding:0; margin:0; font-size:0; line-height:0;">&nbsp;</td>
        </tr>
      </tbody>
    </table>
  </td>
</tr>
<tr>
  <td height="40" style="height: 40px;">
    &nbsp;
  </td>
</tr>
<tr>
  <td width="100%" style="width:100%">
    <a href="{{article_url}}" target="_blank" rel="newsletter" style="text-decoration: none;">
      <p style="font-weight: 400; font-size: 20px; line-height: 143%; text-align: justify; color: #0E1B42;">
        {{article_intro}}
      </p>
    </a>
  </td>
</tr>
<tr>
  <td height="40" style="height: 39px; border-bottom: 1pt solid #0E1B42;">
    &nbsp;
  </td>
</tr>'''


class Migration(migrations.Migration):

    dependencies = [
        ("base", "0010_newslettercampaign_campaign_type_and_weekly_fields"),
    ]

    operations = [
        migrations.RemoveField(
            model_name="newslettertemplate",
            name="template_json",
        ),
        migrations.AlterField(
            model_name="newslettercampaign",
            name="item_template_html",
            field=models.TextField(
                blank=True,
                default=DEFAULT_WEEKLY_ITEM_TEMPLATE,
                verbose_name="Weekly Item HTML Template",
            ),
        ),
    ]
