<odoo>
    <data noupdate="1">
        <record id="visit_notification_template" model="mail.template">
            <field name="name">Visit Assignment Notification</field>
            <field name="model_id" ref="odex_benefit.model_visit_location"/>
            <field name="subject">${object.benefit_id.name or 'New Visit Assigned'}</field>
            <field name="lang">${object.create_uid.lang}</field>
            <field name="auto_delete" eval="True"/>
            <field name="body_html" type="html">
                <table border="0" cellpadding="0" cellspacing="0"
                       style="padding-top: 16px; background-color: #F9F9F9; font-family: Verdana, Arial, sans-serif; color: #333; width: 100%; border-collapse: separate;">
                    <tr>
                        <td align="center">
                            <table border="0" cellpadding="0" cellspacing="0" width="600"
                                   style="background-color: #fff; padding: 16px; border-collapse: separate;">
                                <tr>
                                    <td style="font-size: 14px; line-height: 20px;">
                                        <p>Hello,</p>
                                        <p>A new visit has been assigned to you. Details are below:</p>
                                        <ul>
                                            <li>
                                                <strong>Benefit File:</strong>
                                                ${object.benefit_id.name or 'N/A'}
                                            </li>
                                            <li>
                                                <strong>Visit Number:</strong>
                                                ${object.name or object.id}
                                            </li>
                                            <li>
                                                <strong>Visit Date:</strong>
                                                ${format_date(object.visit_date)}
                                            </li>
                                        </ul>
                                        <p>Please check your dashboard for more details.</p>
                                        <br/>
                                        <p style="font-size: 11px; color: grey;">This is an automated message. Do not
                                            reply.
                                        </p>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </field>
        </record>
        <!-- Attachment Expiration Email Template for family-->
        <record id="attachment_expiration_family_email_template" model="mail.template">
            <field name="name">Attachment Expiration</field>
            <field name="model_id" ref="odex_benefit.model_grant_benefit"/>
            <field name="email_from">
                <![CDATA[${user.company_id.name} <${(user.company_id.email or user.partner_id.email or 'noreply@localhost')|safe}>]]></field>
            <field name="email_to">${(object.get_researchers_email())|safe}</field>
            <field name="email_cc">${(object.email)|safe}</field>
            <field name="subject">Attachment Expiration</field>
            <field name="body_html" type="html">
                <table border="0" cellpadding="0" cellspacing="0"
                       style="padding-top: 16px; background-color: #F1F1F1; font-family:Verdana, Arial,sans-serif; color: #454748; width: 100%; border-collapse:separate;">
                    <tr>
                        <td align="center">
                            <table border="0" cellpadding="0" cellspacing="0" width="590"
                                   style="padding: 16px; background-color: white; color: #454748; border-collapse:separate;">
                                <tbody>
                                    <!-- HEADER -->
                                    <tr>
                                        <td align="center" style="min-width: 590px;">
                                            <table border="0" cellpadding="0" cellspacing="0" width="590"
                                                   style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
                                                <tr>
                                                    <td valign="middle">
                                                    </td>
                                                    <td valign="middle" align="right">
                                                        <img src="/logo.png?company=${object.create_uid.company_id.id}"
                                                             style="padding: 0px; margin: 0px; height: auto; width: 80px;"
                                                             alt="${object.create_uid.company_id.name}"/>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2" style="text-align:center;">
                                                        <hr width="100%"
                                                            style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <!-- CONTENT -->
                                    <tr>
                                        <td align="center" style="min-width: 590px;">
                                            <table border="0" cellpadding="0" cellspacing="0" width="590"
                                                   style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
                                                <tr>
                                                    <td valign="top" style="font-size: 13px;">
                                                        <div>
                                                            <center>
                                                                Family ${object.name},
                                                                <br/>
                                                                <br/>
                                                                Please Update your attachments because some of them has
                                                                been expired!
                                                                <br/>
                                                            </center>
                                                            <br/>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align:center;">
                                                        <hr width="100%"
                                                            style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <!-- FOOTER -->
                                    <tr>
                                        <td align="center" style="min-width: 590px;">
                                            <table border="0" cellpadding="0" cellspacing="0" width="590"
                                                   style="min-width: 590px; background-color: white; font-size: 11px; padding: 0px 8px 0px 8px; border-collapse:separate;">
                                                <tr>
                                                    <td valign="middle" align="left">
                                                        ${object.create_uid.company_id.name}
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td valign="middle" align="left" style="opacity: 0.7;">
                                                        ${object.create_uid.company_id.phone}
                                                        % if object.create_uid.company_id.email
                                                        |
                                                        <a href="'mailto:%s' % ${object.create_uid.company_id.email}"
                                                           style="text-decoration:none; color: #454748;">
                                                            ${object.create_uid.company_id.email}
                                                        </a>
                                                        % endif
                                                        % if object.create_uid.company_id.website
                                                        |
                                                        <a href="'%s' % ${object.create_uid.company_id.website}"
                                                           style="text-decoration:none; color: #454748;">
                                                            ${object.create_uid.company_id.website}
                                                        </a>
                                                        % endif
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                </table>
            </field>
        </record>
        <!-- Schedule a visit -->
        <record id="schedule_a_visit_email_template" model="mail.template">
            <field name="name">Schedule a visit</field>
            <field name="model_id" ref="odex_benefit.model_visit_location"/>
            <field name="email_from">
                <![CDATA[${user.company_id.name} <${(user.company_id.email or user.partner_id.email or 'noreply@localhost')|safe}>]]></field>
            <field name="email_to">${(object.benefit_id.email)|safe}</field>
            <field name="email_cc">${(object.get_researchers_email())|safe}</field>
            <field name="subject">Schedule a visit</field>
            <field name="body_html" type="html">
                <table border="0" cellpadding="0" cellspacing="0"
                       style="padding-top: 16px; background-color: #F1F1F1; font-family:Verdana, Arial,sans-serif; color: #454748; width: 100%; border-collapse:separate;">
                    <tr>
                        <td align="center">
                            <table border="0" cellpadding="0" cellspacing="0" width="590"
                                   style="padding: 16px; background-color: white; color: #454748; border-collapse:separate;">
                                <tbody>
                                    <!-- HEADER -->
                                    <tr>
                                        <td align="center" style="min-width: 590px;">
                                            <table border="0" cellpadding="0" cellspacing="0" width="590"
                                                   style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
                                                <tr>
                                                    <td valign="middle">
                                                    </td>
                                                    <td valign="middle" align="right">
                                                        <img src="/logo.png?company=${object.create_uid.company_id.id}"
                                                             style="padding: 0px; margin: 0px; height: auto; width: 80px;"
                                                             alt="${object.create_uid.company_id.name}"/>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2" style="text-align:center;">
                                                        <hr width="100%"
                                                            style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <!-- CONTENT -->
                                    <tr>
                                        <td align="center" style="min-width: 590px;">
                                            <table border="0" cellpadding="0" cellspacing="0" width="590"
                                                   style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
                                                <tr>
                                                    <td valign="top" style="font-size: 13px;">
                                                        <div>
                                                            <center>
                                                                We want to schedule visit date with Researcher
                                                                ${(object.researcher_ids[1])}
                                                                <br/>
                                                                <br/>
                                                                <br/>
                                                                to family ${(object.benefit_id.name)}
                                                                in this location
                                                                <a href="${object.get_url_local()}" target="_blank"
                                                                   style="color: blue; text-decoration: underline;">
                                                                    ${object.get_url_local()}
                                                                </a>
                                                            </center>
                                                            <br/>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align:center;">
                                                        <hr width="100%"
                                                            style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;"/>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <!-- FOOTER -->
                                    <tr>
                                        <td align="center" style="min-width: 590px;">
                                            <table border="0" cellpadding="0" cellspacing="0" width="590"
                                                   style="min-width: 590px; background-color: white; font-size: 11px; padding: 0px 8px 0px 8px; border-collapse:separate;">
                                                <tr>
                                                    <td valign="middle" align="left">
                                                        ${object.create_uid.company_id.name}
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td valign="middle" align="left" style="opacity: 0.7;">
                                                        ${object.create_uid.company_id.phone}
                                                        % if object.create_uid.company_id.email
                                                        |
                                                        <a href="'mailto:%s' % ${object.create_uid.company_id.email}"
                                                           style="text-decoration:none; color: #454748;">
                                                            ${object.create_uid.company_id.email}
                                                        </a>
                                                        % endif
                                                        % if object.create_uid.company_id.website
                                                        |
                                                        <a href="'%s' % ${object.create_uid.company_id.website}"
                                                           style="text-decoration:none; color: #454748;">
                                                            ${object.create_uid.company_id.website}
                                                        </a>
                                                        % endif
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                </table>
            </field>
        </record>
        <!--Visit Location OTP Email-->
        <record id="visit_location_otp_email_template" model="mail.template">
            <field name="name">Visit Location OTP Email</field>
            <field name="model_id" ref="odex_benefit.model_visit_location"/>
            <field name="subject">Your OTP Code</field>
            <field name="body_html" type="html">
                <table border="0" cellpadding="0" cellspacing="0"
                       style="padding-top:16px;background-color:#F9F9F9;font-family:Verdana,Arial,sans-serif;color:#333;width:100%;border-collapse:separate;">
                    <tr>
                        <td align="center">
                            <table border="0" cellpadding="0" cellspacing="0" width="600"
                                   style="background-color:#fff;padding:24px;border-radius:8px;border-collapse:separate;">
                                <tr>
                                    <td style="font-size:14px;line-height:20px;">
                                        <p>Hello,</p>
                                        <p>Your OTP for confirming visit <strong>${object.name}</strong> is:
                                        </p>

                                        <!-- OTP Block -->
                                        <div style="text-align:center;margin:20px 0;">
                                            <span style="display:inline-block;background-color:#2c3e50;color:#ffffff;
                                                 font-size:24px;font-weight:bold;padding:12px 24px;
                                                 border-radius:6px;letter-spacing:3px;">
                                                ${object.otp_code}
                                            </span>
                                        </div>

                                        <p>This code is valid for <strong>
                                            ${object.visit_types.otp_validity_minutes or 5}
                                        </strong> minutes.
                                        </p>
                                        <br/>
                                        <p>Regards,
                                            <br/>
                                            <strong>${user.company_id.name}</strong>
                                        </p>

                                        <br/>
                                        <p style="font-size:11px;color:grey;">
                                            This is an automated message. Please do not reply.
                                        </p>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </field>
        </record>
        <!--Visit Location OTP SMS-->
        <record id="visit_location_otp_sms_template" model="sms.template">
            <field name="name">Visit Location OTP</field>
            <field name="model_id" ref="odex_benefit.model_visit_location"/>
            <field name="body">
                Hello Your verification code for ${object.name} visit is ${object.otp_code}.
                It is valid for ${object.visit_types.otp_validity_minutes or 5} minutes.
            </field>
        </record>

        <!--Visit Location Survey SMS-->
        <record id="visit_location_survey_sms_template" model="sms.template">
            <field name="name">Visit Location Survey SMS</field>
            <field name="model_id" ref="odex_benefit.model_visit_location"/>
            <field name="body">
                Dear family, please complete the evaluation form for visit ${object.name}: ${object.survey_url}
            </field>
        </record>
        <!--Visit Location Survey Email-->
        <record id="visit_location_survey_email_template" model="mail.template">
            <field name="name">Visit Location Survey Email</field>
            <field name="model_id" ref="odex_benefit.model_visit_location"/>
            <field name="subject">Family Evaluation Survey - ${object.name}</field>
            <field name="body_html" type="html">
                <div style="background-color:#f9f9f9;padding:30px;
                    font-family:Arial,sans-serif;color:#333;
                    font-size:16px;line-height:24px;">

                    <p>Hello,</p>

                    <p>Please complete the evaluation form for your visit:
                        <strong>${object.name}</strong>.
                    </p>

                    <!-- CTA Button -->
                    <p style="text-align:center;margin:30px 0;">
                        <a href="${object.survey_url}"
                           style="display:inline-block;
                                  padding:14px 32px;
                                  background:linear-gradient(135deg,#e6f0ff,#cce0ff);
                                  color:#003366;
                                  font-size:16px;
                                  font-weight:600;
                                  text-decoration:none;
                                  border-radius:6px;
                                  border:1px solid #99c2ff;
                                  box-shadow:0 4px 6px rgba(0,0,0,0.05);">
                            Open Survey
                        </a>
                    </p>

                    <p>Thank you for your cooperation.
                        <br/>
                        <strong>${user.company_id.name}</strong>
                    </p>

                    <hr style="border:none;border-top:1px solid #ddd;margin:30px 0;"/>

                    <p style="font-size:12px;color:#888;">
                        This is an automated message. Please do not reply.
                    </p>
                </div>
            </field>
        </record>

    </data>
</odoo>
