<?xml version="1.0" encoding="UTF-8"?>
<odoo>

    <record id="fusion_schedule_booking_confirmation" model="mail.template">
        <field name="name">Fusion Schedule: Booking Confirmation</field>
        <field name="model_id" ref="calendar.model_calendar_event"/>
        <field name="subject">Your Appointment — {{ object.name }}</field>
        <field name="email_from">{{ (object.user_id.email_formatted or object.user_id.company_id.email_formatted or '') }}</field>
        <field name="email_to">{{ object.x_fc_client_email }}</field>
        <field name="lang">{{ object.partner_ids[:1].lang }}</field>
        <field name="auto_delete" eval="True"/>
        <field name="body_html" type="html">
<div style="margin:0;padding:0;">
    <table width="100%" cellpadding="0" cellspacing="0"
           style="padding:24px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;">
        <tr>
            <td align="center">
                <table width="560" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
                    <!-- Logo -->
                    <tr>
                        <td style="padding:0 0 24px;text-align:center;">
                            <t t-if="object.user_id.company_id.logo_web">
                                <img t-att-src="'/web/image/res.company/%s/logo_web' % object.user_id.company_id.id"
                                     style="max-height:44px;max-width:180px;" alt="Logo"/>
                            </t>
                            <t t-else="">
                                <span style="font-size:18px;font-weight:700;letter-spacing:0.5px;">
                                    <t t-out="object.user_id.company_id.name or ''"/>
                                </span>
                            </t>
                        </td>
                    </tr>
                    <!-- Confirmation badge -->
                    <tr>
                        <td style="padding:0 0 20px;text-align:center;">
                            <span style="display:inline-block;background-color:#16a34a;color:#ffffff;font-size:13px;font-weight:600;padding:6px 18px;border-radius:20px;letter-spacing:0.3px;">
                                &#10003; Confirmed
                            </span>
                        </td>
                    </tr>
                    <!-- Greeting -->
                    <tr>
                        <td style="padding:0 0 28px;text-align:center;">
                            <p style="margin:0;font-size:15px;line-height:1.6;">
                                Hi<t t-if="object.x_fc_client_email"> <t t-out="object.partner_ids.filtered(lambda p: p.email == object.x_fc_client_email)[:1].name or ''"/></t>,
                                your appointment has been confirmed.
                            </p>
                        </td>
                    </tr>
                    <!-- Details card -->
                    <tr>
                        <td style="padding:0 0 28px;">
                            <table width="100%" cellpadding="0" cellspacing="0"
                                   style="border:1px solid #d1d5db;border-radius:10px;border-collapse:separate;">
                                <!-- Date -->
                                <tr>
                                    <td style="padding:20px 24px;border-bottom:1px solid #d1d5db;">
                                        <table width="100%" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td width="32" valign="top" style="padding-right:14px;font-size:20px;">&#128197;</td>
                                                <td>
                                                    <span style="font-size:16px;font-weight:600;">
                                                        <t t-out="object.start" t-options="{'widget': 'datetime', 'format': 'EEEE, MMMM d, yyyy'}"/>
                                                    </span>
                                                    <br/>
                                                    <span style="font-size:14px;">
                                                        <t t-out="object.start" t-options="{'widget': 'datetime', 'format': 'h:mm a'}"/>
                                                        &#8211;
                                                        <t t-out="object.stop" t-options="{'widget': 'datetime', 'format': 'h:mm a'}"/>
                                                        (<t t-out="'%g' % object.duration"/> hr<t t-if="object.duration != 1.0">s</t>)
                                                    </span>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <!-- Location -->
                                <t t-if="object.location">
                                    <tr>
                                        <td style="padding:20px 24px;border-bottom:1px solid #d1d5db;">
                                            <table width="100%" cellpadding="0" cellspacing="0">
                                                <tr>
                                                    <td width="32" valign="top" style="padding-right:14px;font-size:20px;">&#128205;</td>
                                                    <td>
                                                        <span style="font-size:14px;">
                                                            <t t-out="object.location"/>
                                                        </span>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </t>
                                <!-- Scheduled with -->
                                <tr>
                                    <td style="padding:20px 24px;">
                                        <table width="100%" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td width="32" valign="top" style="padding-right:14px;font-size:20px;">&#128100;</td>
                                                <td>
                                                    <span style="font-size:14px;font-weight:600;">
                                                        <t t-out="object.user_id.name"/>
                                                    </span>
                                                    <t t-if="object.user_id.company_id.phone">
                                                        <br/>
                                                        <span style="font-size:13px;">
                                                            <t t-out="object.user_id.company_id.phone"/>
                                                        </span>
                                                    </t>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <!-- Manage button -->
                    <t t-if="object.x_fc_manage_token">
                        <tr>
                            <td style="padding:0 0 32px;text-align:center;">
                                <a t-att-href="'%s/schedule/manage/%s' % (object.user_id.company_id.website or (object.get_base_url()), object.x_fc_manage_token)"
                                   style="display:inline-block;background-color:#2563eb;color:#ffffff;padding:13px 36px;border-radius:8px;text-decoration:none;font-size:14px;font-weight:600;">
                                    Manage Appointment
                                </a>
                                <br/>
                                <span style="font-size:12px;margin-top:10px;display:inline-block;">
                                    Reschedule or cancel anytime
                                </span>
                            </td>
                        </tr>
                    </t>
                    <!-- Divider -->
                    <tr><td style="border-top:1px solid #d1d5db;padding:0;font-size:0;line-height:0;">&#160;</td></tr>
                    <!-- Footer -->
                    <tr>
                        <td style="padding:20px 0 0;text-align:center;">
                            <p style="margin:0;font-size:12px;line-height:1.6;">
                                <t t-out="object.user_id.company_id.name or ''"/>
                                <t t-if="object.user_id.company_id.street">
                                    <br/><t t-out="object.user_id.company_id.street"/>
                                    <t t-if="object.user_id.company_id.city">, <t t-out="object.user_id.company_id.city"/></t>
                                    <t t-if="object.user_id.company_id.state_id"> <t t-out="object.user_id.company_id.state_id.code"/></t>
                                    <t t-if="object.user_id.company_id.zip"> <t t-out="object.user_id.company_id.zip"/></t>
                                </t>
                            </p>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>
        </field>
    </record>

</odoo>
