<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
  Usable Outlook add-in (classic XML manifest, MailApp).

  This is a MAIL add-in, so it differs from the document hosts:
    - xsi:type="MailApp" (not TaskPaneApp).
    - Activation via <Rule> (legacy clients) + Mailbox requirement set.
    - VersionOverrides uses the *mailappversionoverrides* namespace and declares
      Message (read + compose) AND Appointment (attendee read + organizer compose)
      command surfaces so the one task pane appears whether the user is reading or
      composing a mail OR has a calendar appointment open.
  Everything else (icons, URLs, the dev→prod HOST_BASE_URL transform) is shared
  with the other apps via @usable/build-config. The dev localhost:3336 URLs are
  rewritten to the hosted /outlook/ path at build time for production.
-->
<OfficeApp
  xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
  xsi:type="MailApp">

  <!-- ==== Identity ==== -->
  <Id>e70ba034-6573-47b6-8c9b-f0a1b6e436df</Id>
  <Version>1.0.0.0</Version>
  <ProviderName>Usable</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <DisplayName DefaultValue="Usable Outlook" />
  <Description DefaultValue="AI-powered Outlook assistant — talk to Usable Chat and let AI read your mail and calendar, summarize, and draft replies and appointments." />
  <IconUrl DefaultValue="https://msoffice.usable.dev/outlook/assets/icon-32.png" />
  <HighResolutionIconUrl DefaultValue="https://msoffice.usable.dev/outlook/assets/icon-80.png" />
  <SupportUrl DefaultValue="https://usable.dev" />

  <!-- ==== Allowed external domains ==== -->
  <AppDomains>
    <AppDomain>https://chat.usable.dev</AppDomain>
    <AppDomain>https://api.usable.dev</AppDomain>
  </AppDomains>

  <!-- ==== Hosts ==== -->
  <Hosts>
    <Host Name="Mailbox" />
  </Hosts>

  <!-- ==== Requirements (mailbox API surface used by the tools) ==== -->
  <!--
    Mailbox 1.8 (bumped from 1.5): the feature-rich tool set uses members above
    the base set — item categories (get/add/remove) and getAllInternetHeadersAsync
    are 1.8; prepend/reply/attachments/saveAsync/displayNewMessageForm are all ≤1.6.
    1.8 is the highest set any tool needs, so it is the floor. Tools that touch the
    1.8 surface still feature-detect at call time and fail with a clear message on a
    client that under-reports its API surface.
  -->
  <Requirements>
    <Sets>
      <Set Name="Mailbox" MinVersion="1.8" />
    </Sets>
  </Requirements>

  <!-- ==== Legacy form settings (older clients without VersionOverrides) ==== -->
  <FormSettings>
    <Form xsi:type="ItemRead">
      <DesktopSettings>
        <SourceLocation DefaultValue="https://msoffice.usable.dev/outlook/taskpane.html" />
        <RequestedHeight>250</RequestedHeight>
      </DesktopSettings>
    </Form>
  </FormSettings>

  <!-- ==== Permissions: read + write the current item (set body/subject/recipients) ==== -->
  <Permissions>ReadWriteItem</Permissions>

  <!-- ==== Activation rules (legacy): show on read AND compose of a message OR appointment ==== -->
  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read" />
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Edit" />
    <Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Read" />
    <Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Edit" />
  </Rule>
  <DisableEntityHighlighting>false</DisableEntityHighlighting>

  <!-- ==== Version overrides (ribbon buttons + task pane, modern clients) ==== -->
  <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">

    <Requirements>
      <bt:Sets DefaultMinVersion="1.8">
        <bt:Set Name="Mailbox" />
      </bt:Sets>
    </Requirements>

    <Hosts>
      <Host xsi:type="MailHost">
        <DesktopFormFactor>

          <!-- Commands page (no-UI function file) -->
          <FunctionFile resid="Commands.Url" />

          <!-- Reading a message -->
          <ExtensionPoint xsi:type="MessageReadCommandSurface">
            <OfficeTab id="TabDefault">
              <Group id="Usable.ReadGroup">
                <Label resid="Group.Label" />
                <Control xsi:type="Button" id="Usable.ReadOpen">
                  <Label resid="OpenTaskPane.Label" />
                  <Supertip>
                    <Title resid="OpenTaskPane.Label" />
                    <Description resid="OpenTaskPane.Tooltip" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Icon.16x16" />
                    <bt:Image size="32" resid="Icon.32x32" />
                    <bt:Image size="80" resid="Icon.80x80" />
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <SourceLocation resid="Taskpane.Url" />
                  </Action>
                </Control>
              </Group>
            </OfficeTab>
          </ExtensionPoint>

          <!-- Composing a message -->
          <ExtensionPoint xsi:type="MessageComposeCommandSurface">
            <OfficeTab id="TabDefault">
              <Group id="Usable.ComposeGroup">
                <Label resid="Group.Label" />
                <Control xsi:type="Button" id="Usable.ComposeOpen">
                  <Label resid="OpenTaskPane.Label" />
                  <Supertip>
                    <Title resid="OpenTaskPane.Label" />
                    <Description resid="OpenTaskPane.Tooltip" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Icon.16x16" />
                    <bt:Image size="32" resid="Icon.32x32" />
                    <bt:Image size="80" resid="Icon.80x80" />
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <SourceLocation resid="Taskpane.Url" />
                  </Action>
                </Control>
              </Group>
            </OfficeTab>
          </ExtensionPoint>

          <!-- Reading an appointment (attendee view) -->
          <ExtensionPoint xsi:type="AppointmentAttendeeCommandSurface">
            <OfficeTab id="TabDefault">
              <Group id="Usable.ApptReadGroup">
                <Label resid="Group.Label" />
                <Control xsi:type="Button" id="Usable.ApptReadOpen">
                  <Label resid="OpenTaskPane.Label" />
                  <Supertip>
                    <Title resid="OpenTaskPane.Label" />
                    <Description resid="OpenTaskPane.Tooltip" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Icon.16x16" />
                    <bt:Image size="32" resid="Icon.32x32" />
                    <bt:Image size="80" resid="Icon.80x80" />
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <SourceLocation resid="Taskpane.Url" />
                  </Action>
                </Control>
              </Group>
            </OfficeTab>
          </ExtensionPoint>

          <!-- Organizing an appointment (compose view) -->
          <ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
            <OfficeTab id="TabDefault">
              <Group id="Usable.ApptOrganizerGroup">
                <Label resid="Group.Label" />
                <Control xsi:type="Button" id="Usable.ApptOrganizerOpen">
                  <Label resid="OpenTaskPane.Label" />
                  <Supertip>
                    <Title resid="OpenTaskPane.Label" />
                    <Description resid="OpenTaskPane.Tooltip" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Icon.16x16" />
                    <bt:Image size="32" resid="Icon.32x32" />
                    <bt:Image size="80" resid="Icon.80x80" />
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <SourceLocation resid="Taskpane.Url" />
                  </Action>
                </Control>
              </Group>
            </OfficeTab>
          </ExtensionPoint>

        </DesktopFormFactor>
      </Host>
    </Hosts>

    <Resources>
      <bt:Images>
        <bt:Image id="Icon.16x16" DefaultValue="https://msoffice.usable.dev/outlook/assets/icon-16.png" />
        <bt:Image id="Icon.32x32" DefaultValue="https://msoffice.usable.dev/outlook/assets/icon-32.png" />
        <bt:Image id="Icon.80x80" DefaultValue="https://msoffice.usable.dev/outlook/assets/icon-80.png" />
      </bt:Images>
      <bt:Urls>
        <bt:Url id="Taskpane.Url" DefaultValue="https://msoffice.usable.dev/outlook/taskpane.html" />
        <bt:Url id="Commands.Url" DefaultValue="https://msoffice.usable.dev/outlook/commands.html" />
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="Group.Label" DefaultValue="Usable" />
        <bt:String id="OpenTaskPane.Label" DefaultValue="Usable Chat" />
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="OpenTaskPane.Tooltip" DefaultValue="Open the Usable AI chat panel to read, summarize, and draft email with AI." />
      </bt:LongStrings>
    </Resources>

  </VersionOverrides>

</OfficeApp>
