<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
  Production Outlook add-in manifest for the Office LLM Assistant (Outlook host).

  SEPARATE add-in from manifest.xml (Word/Excel/PowerPoint): MailApp xsi:type,
  loaded into the Outlook reading/compose panes. Targets Mailbox 1.8,
  ReadWriteMailbox. Mailbox-wide operations (search, send, folder, free/busy)
  require Microsoft Graph and are gated server-side (server/entitlements.py);
  see docs/OUTLOOK_PHASE0.md.

  SCHEMA NOTES (fixed 2026-09 — the previous revision never loaded in any
  Outlook client; it mixed three different schemas):
  - The mail VersionOverrides V1_0 block uses the
    http://schemas.microsoft.com/office/mailappversionoverrides namespace with
    xsi:type="VersionOverridesV1_0" (type and namespace must match).
  - A V1_1 override (SupportsPinning etc.) is nested INSIDE the V1_0 block as
    <VersionOverrides xmlns=".../1.1" xsi:type="VersionOverridesV1_1"> and is
    the LAST child; it does NOT inherit the parent, so it repeats
    Requirements/Hosts/Resources. There is NO <VersionOverridesV1_1> element.
  - The only valid mail Host xsi:type is "MailHost"; read and compose are
    expressed as SEPARATE ExtensionPoints (MessageReadCommandSurface /
    MessageComposeCommandSurface) inside ONE DesktopFormFactor.
  - Mail ShowTaskpane has NO <TaskpaneId> (that element belongs to the task
    pane app schema). Children: SourceLocation [+, SupportsPinning in V1_1].
  - Mail Group has NO <Icon> child (Label + Controls only); icons go on the
    Button's <Icon>.
  - Inside VersionOverrides, Sets/Set come from the basic-types schema and must
    be written bt:Sets / bt:Set.
  - The base manifest MUST carry <Requirements> and <FormSettings> for mail
    add-in validation (FormSettings is ignored when VersionOverrides is
    present, but is required by the validator).
  - <CustomPane> (a desktop-only preview feature, Mailbox 1.15preview) is
    removed: it is ignored on Outlook on the web / new Outlook and its
    previous form here was schema-invalid.

  URLs mirror manifest.xml (office-assistant.cerena.pt); the deploy to the
  CERENA production host rewrites the origin to https://office-assistant.cerena.pt
  on the server (same procedure as manifest.xml). The <Version> must match the
  VERSION file so Office's per-version cache invalidates on every deploy.
-->
<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">
  <Id>e7f8a9b0-1c2d-3e4f-5a6b-7c8d9e0f1a2b</Id>
  <Version>2.1.0.0</Version>
  <ProviderName>Office LLM Assistant</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <DisplayName DefaultValue="Office LLM Assistant (Outlook)"/>
  <Description DefaultValue="AI-powered assistant for Outlook. Read and compose support with the LLM assistant and Microsoft Graph."/>
  <IconUrl DefaultValue="https://office-assistant.cerena.pt/assets/icon-32.png"/>
  <HighResolutionIconUrl DefaultValue="https://office-assistant.cerena.pt/assets/icon-80.png"/>
  <SupportUrl DefaultValue="https://office-assistant.cerena.pt/support"/>
  <AppDomains>
    <AppDomain>https://office-assistant.cerena.pt</AppDomain>
  </AppDomains>
  <Hosts>
    <Host Name="Mailbox"/>
  </Hosts>
  <Requirements>
    <Sets>
      <Set Name="Mailbox" MinVersion="1.8"/>
    </Sets>
  </Requirements>
  <!-- Required by the mail manifest validator; ignored when VersionOverrides
       is present (which it is below). -->
  <FormSettings>
    <Form xsi:type="ItemRead">
      <DesktopSettings>
        <SourceLocation DefaultValue="https://office-assistant.cerena.pt/taskpane.html"/>
        <RequestedHeight>450</RequestedHeight>
      </DesktopSettings>
    </Form>
  </FormSettings>
  <Permissions>ReadWriteMailbox</Permissions>
  <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>
  <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>
          <!-- Reading pane command surface -->
          <ExtensionPoint xsi:type="MessageReadCommandSurface">
            <OfficeTab id="TabDefault">
              <Group id="OfficeLLMGroupOutlookRead">
                <Label resid="GroupLabel"/>
                <Control xsi:type="Button" id="OpenLLMReadButton">
                  <Label resid="OpenLLMButtonLabel"/>
                  <Supertip>
                    <Title resid="OpenLLMButtonTitle"/>
                    <Description resid="OpenLLMButtonDesc"/>
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Icon16"/>
                    <bt:Image size="32" resid="Icon32"/>
                    <bt:Image size="80" resid="Icon80"/>
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <SourceLocation resid="TaskpaneUrl"/>
                  </Action>
                </Control>
              </Group>
            </OfficeTab>
          </ExtensionPoint>
          <!-- Compose command surface -->
          <ExtensionPoint xsi:type="MessageComposeCommandSurface">
            <OfficeTab id="TabDefault">
              <Group id="OfficeLLMGroupOutlookCompose">
                <Label resid="GroupLabel"/>
                <Control xsi:type="Button" id="OpenLLMComposeButton">
                  <Label resid="OpenLLMButtonLabel"/>
                  <Supertip>
                    <Title resid="OpenLLMButtonTitle"/>
                    <Description resid="OpenLLMButtonDesc"/>
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Icon16"/>
                    <bt:Image size="32" resid="Icon32"/>
                    <bt:Image size="80" resid="Icon80"/>
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <SourceLocation resid="TaskpaneUrl"/>
                  </Action>
                </Control>
              </Group>
            </OfficeTab>
          </ExtensionPoint>
        </DesktopFormFactor>
      </Host>
    </Hosts>
    <Resources>
      <bt:Images>
        <bt:Image id="Icon16" DefaultValue="https://office-assistant.cerena.pt/assets/icon-16.png"/>
        <bt:Image id="Icon32" DefaultValue="https://office-assistant.cerena.pt/assets/icon-32.png"/>
        <bt:Image id="Icon80" DefaultValue="https://office-assistant.cerena.pt/assets/icon-80.png"/>
      </bt:Images>
      <bt:Urls>
        <bt:Url id="TaskpaneUrl" DefaultValue="https://office-assistant.cerena.pt/taskpane.html"/>
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="GroupLabel" DefaultValue="Office LLM"/>
        <bt:String id="OpenLLMButtonLabel" DefaultValue="Open Assistant"/>
        <bt:String id="OpenLLMButtonTitle" DefaultValue="Open the LLM Assistant"/>
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="OpenLLMButtonDesc" DefaultValue="Open the Office LLM Assistant task pane to chat with the current mail item"/>
      </bt:LongStrings>
    </Resources>
    <!-- V1_1 nested override (LAST child of the V1_0 block). Does not inherit:
         repeats Requirements/Hosts/Resources, adding SupportsPinning. -->
    <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
      <Requirements>
        <bt:Sets DefaultMinVersion="1.8">
          <bt:Set Name="Mailbox"/>
        </bt:Sets>
      </Requirements>
      <Hosts>
        <Host xsi:type="MailHost">
          <DesktopFormFactor>
            <ExtensionPoint xsi:type="MessageReadCommandSurface">
              <OfficeTab id="TabDefault">
                <Group id="OfficeLLMGroupOutlookRead">
                  <Label resid="GroupLabel"/>
                  <Control xsi:type="Button" id="OpenLLMReadButton">
                    <Label resid="OpenLLMButtonLabel"/>
                    <Supertip>
                      <Title resid="OpenLLMButtonTitle"/>
                      <Description resid="OpenLLMButtonDesc"/>
                    </Supertip>
                    <Icon>
                      <bt:Image size="16" resid="Icon16"/>
                      <bt:Image size="32" resid="Icon32"/>
                      <bt:Image size="80" resid="Icon80"/>
                    </Icon>
                    <Action xsi:type="ShowTaskpane">
                      <SourceLocation resid="TaskpaneUrl"/>
                      <SupportsPinning>true</SupportsPinning>
                    </Action>
                  </Control>
                </Group>
              </OfficeTab>
            </ExtensionPoint>
            <ExtensionPoint xsi:type="MessageComposeCommandSurface">
              <OfficeTab id="TabDefault">
                <Group id="OfficeLLMGroupOutlookCompose">
                  <Label resid="GroupLabel"/>
                  <Control xsi:type="Button" id="OpenLLMComposeButton">
                    <Label resid="OpenLLMButtonLabel"/>
                    <Supertip>
                      <Title resid="OpenLLMButtonTitle"/>
                      <Description resid="OpenLLMButtonDesc"/>
                    </Supertip>
                    <Icon>
                      <bt:Image size="16" resid="Icon16"/>
                      <bt:Image size="32" resid="Icon32"/>
                      <bt:Image size="80" resid="Icon80"/>
                    </Icon>
                    <Action xsi:type="ShowTaskpane">
                      <SourceLocation resid="TaskpaneUrl"/>
                      <SupportsPinning>true</SupportsPinning>
                    </Action>
                  </Control>
                </Group>
              </OfficeTab>
            </ExtensionPoint>
          </DesktopFormFactor>
        </Host>
      </Hosts>
      <Resources>
        <bt:Images>
          <bt:Image id="Icon16" DefaultValue="https://office-assistant.cerena.pt/assets/icon-16.png"/>
          <bt:Image id="Icon32" DefaultValue="https://office-assistant.cerena.pt/assets/icon-32.png"/>
          <bt:Image id="Icon80" DefaultValue="https://office-assistant.cerena.pt/assets/icon-80.png"/>
        </bt:Images>
        <bt:Urls>
          <bt:Url id="TaskpaneUrl" DefaultValue="https://office-assistant.cerena.pt/taskpane.html"/>
        </bt:Urls>
        <bt:ShortStrings>
          <bt:String id="GroupLabel" DefaultValue="Office LLM"/>
          <bt:String id="OpenLLMButtonLabel" DefaultValue="Open Assistant"/>
          <bt:String id="OpenLLMButtonTitle" DefaultValue="Open the LLM Assistant"/>
        </bt:ShortStrings>
        <bt:LongStrings>
          <bt:String id="OpenLLMButtonDesc" DefaultValue="Open the Office LLM Assistant task pane to chat with the current mail item"/>
        </bt:LongStrings>
      </Resources>
    </VersionOverrides>
  </VersionOverrides>
</OfficeApp>
