<?php

class Migration_20240903141639_setInitial_qr_code_template
{
    public static function up(PDO $pdo)
    {

        $templateHtml1 = '%3Ch2%20style%3D%22text-align%3Acenter%22%3E%3Cimg%20alt%3D%22%22%20src%3D%22%2Finclude%2Fimages%2Fhouse-roof.svg.hi.png%22%20style%3D%22height%3A115px%3B%20width%3A450px%22%20%2F%3E%3C%2Fh2%3E%0A%0A%3Ch2%20style%3D%22text-align%3Acenter%22%3E%3Cspan%20style%3D%22font-size%3A26px%22%3EWelcome%20to%20the%20property%3C%2Fspan%3E%3C%2Fh2%3E%0A%0A%3Ch3%20style%3D%22text-align%3Acenter%22%3E%3Cstrong%3E%3Cspan%20style%3D%22font-size%3A14px%22%3ESCAN%20TO%20CALL%3C%2Fspan%3E%26nbsp%3B%3C%2Fstrong%3E%3C%2Fh3%3E%0A%0A%3Ch3%20style%3D%22text-align%3Acenter%22%3EOR%3C%2Fh3%3E%0A%0A%3Cp%20style%3D%22text-align%3Acenter%22%3E%3Cimg%20alt%3D%22%22%20src%3D%22%2Finclude%2Fimages%2Fqr-code.svg%22%20style%3D%22height%3A200px%3B%20width%3A200px%22%20%2F%3E%3C%2Fp%3E%0A%0A%3Cp%3E%26nbsp%3B%3C%2Fp%3E%0A';
        $templateHtml2 = '%3Cp%20style%3D%22text-align%3Acenter%22%3E%3Cstrong%3E%3Cspan%20style%3D%22font-size%3A20px%22%3E%3Cimg%20alt%3D%22%22%20src%3D%22%2Finclude%2Fimages%2Froof_top.jpg%22%20style%3D%22height%3A100px%3B%20width%3A400px%22%20%2F%3E%3C%2Fspan%3E%3C%2Fstrong%3E%3C%2Fp%3E%0A%0A%3Cp%20style%3D%22text-align%3Acenter%22%3E%26nbsp%3B%3C%2Fp%3E%0A%0A%3Cp%20style%3D%22text-align%3Acenter%22%3E%3Cspan%20style%3D%22font-size%3A24px%22%3E%3Cstrong%3EWelcome%20to%20my%20property!%3C%2Fstrong%3E%3C%2Fspan%3E%3C%2Fp%3E%0A%0A%3Cp%20style%3D%22text-align%3Acenter%22%3E%3Cspan%20style%3D%22font-size%3A14px%22%3E%3Cspan%20style%3D%22font-family%3ATahoma%2CGeneva%2Csans-serif%22%3EScan%20to%20call%3C%2Fspan%3E%3C%2Fspan%3E%3C%2Fp%3E%0A%0A%3Cp%20style%3D%22text-align%3Acenter%22%3E%3Cspan%20style%3D%22font-size%3A28px%22%3E%3Cstrong%3E%3Cspan%20style%3D%22font-family%3ATahoma%2CGeneva%2Csans-serif%22%3EOR%3C%2Fspan%3E%3C%2Fstrong%3E%3C%2Fspan%3E%3C%2Fp%3E%0A%0A%3Cp%20style%3D%22text-align%3Acenter%22%3E%3Cimg%20alt%3D%22%22%20src%3D%22%2Finclude%2Fimages%2Fqr-code.svg%22%20style%3D%22border-style%3Asolid%3B%20border-width%3A2px%3B%20height%3A200px%3B%20width%3A200px%22%20%2F%3E%3C%2Fp%3E%0A';
        $sql = "
    INSERT INTO qr_code_templates (
        templateName,
        position_ring_color,
        position_center_color,
        position_module_color,
        frameType,
        templateHtml,
        CreatedBy,
        createdAt,
        updatedAt
    ) VALUES
    ('Template 1', '#000000', '#000000', '#000000', 0, '$templateHtml2', '', NOW(), NOW()),
    ('Template 2', '#144d1b', '#18480e', '#10400c', 0, '$templateHtml1', '', NOW(), NOW())
    ";

        $pdo->exec($sql);
    }

    public static function down(PDO $pdo)
    {
        // SQL query to delete the QR code template
        $sql = "DELETE FROM qr_code_templates WHERE id = :id";

        $stmt = $pdo->prepare($sql);

        // Bind parameters
        $stmt->bindValue(':id', 8, PDO::PARAM_INT);

        // Execute the query
        $stmt->execute();
    }
}
