<?xml version="1.0" encoding="UTF-8"?>
<!--
  Spectre for Word — manifest template.

  Placeholders are filled by scripts/build-manifest.cjs:
    82af6713-9f04-455c-bd79-ca2db30aee0c        — stable id of THIS add-in (distinct from Outlook's)
    https://word.spectrelegal.app    — HTTPS root where dist/ is hosted (dev: https://localhost:3001)
    0937dbe5-072c-4ad7-bc27-a9e5b2f0685c  — Azure AD app client id (shared with Outlook add-in for SSO)
    api://word.spectrelegal.app/0937dbe5-072c-4ad7-bc27-a9e5b2f0685c    — api://<host>/<client-id>

  Build dev variant + sideload:
    pnpm build:manifest:dev && pnpm validate-manifest && pnpm sideload
-->
<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="TaskPaneApp">

  <Id>82af6713-9f04-455c-bd79-ca2db30aee0c</Id>
  <Version>1.0.1.0</Version>
  <ProviderName>Spectre Legal</ProviderName>
  <!--
    Primary market is pl-PL; en-US overrides exist for AppSource discovery +
    English-preferring Word clients. Runtime UI uses vue-i18n with locale
    detection via Office.context.displayLanguage — see src/i18n/.
  -->
  <DefaultLocale>pl-PL</DefaultLocale>
  <DisplayName DefaultValue="Spectre">
    <Override Locale="en-US" Value="Spectre"/>
  </DisplayName>
  <Description DefaultValue="Twórz drafty z szablonów, wypełniaj dokumenty danymi sprawy i nanoś poprawki AI jako recenzję — bez wychodzenia z Worda.">
    <Override Locale="en-US" Value="Draft from templates, fill documents with case data, and apply AI edits as tracked changes — without leaving Word."/>
  </Description>
  <IconUrl DefaultValue="https://word.spectrelegal.app/assets/icon-64.png"/>
  <HighResolutionIconUrl DefaultValue="https://word.spectrelegal.app/assets/icon-128.png"/>
  <!--
    AppSource requires SupportUrl to lead to a real support/help page (the
    shared compliance site also hosts privacy + terms). The install.html
    one-pager on the addin host remains for direct/manual installs.
  -->
  <SupportUrl DefaultValue="https://support.spectrelegal.app"/>

  <!--
    AppDomains must list every cross-origin destination the taskpane iframe
    talks to: the add-in's own host, the Spectre API, and the support site.
  -->
  <AppDomains>
    <AppDomain>https://word.spectrelegal.app</AppDomain>
    <AppDomain>https://spectrelegal.app</AppDomain>
    <AppDomain>https://support.spectrelegal.app</AppDomain>
  </AppDomains>

  <Hosts>
    <Host Name="Document"/>
  </Hosts>

  <!--
    Manifest baseline = WordApi 1.3 (broad install base: ribbon button +
    content controls + search + insertHtml). Features above 1.3 are
    feature-detected at runtime (see src/lib/office/capabilities.ts):
      - comments + change tracking  → WordApi 1.4
      - footnotes                   → WordApi 1.5
    The capability spike (src/taskpane/views/Spike.vue) reports exactly which
    sets the user's Word build supports.

    IdentityAPI 1.3 gates installs to clients where Office.auth.getAccessToken
    works (Word on Windows/Mac with Microsoft 365 + Word on the web). The
    add-in has NO fallback auth, so without this gate AppSource would test it
    on iPad and perpetual 2016/2019 builds where sign-in can never succeed.
  -->
  <Requirements>
    <Sets DefaultMinVersion="1.3">
      <Set Name="WordApi" MinVersion="1.3"/>
      <Set Name="IdentityAPI" MinVersion="1.3"/>
    </Sets>
  </Requirements>

  <DefaultSettings>
    <SourceLocation DefaultValue="https://word.spectrelegal.app/src/taskpane/index.html"/>
  </DefaultSettings>

  <!-- We read + write document content (insert drafts, fill templates, redline). -->
  <Permissions>ReadWriteDocument</Permissions>

  <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Hosts>
      <Host xsi:type="Document">
        <DesktopFormFactor>
          <GetStarted>
            <Title resid="GetStarted.Title"/>
            <Description resid="GetStarted.Description"/>
            <LearnMoreUrl resid="GetStarted.LearnMoreUrl"/>
          </GetStarted>
          <FunctionFile resid="Commands.Url"/>
          <ExtensionPoint xsi:type="PrimaryCommandSurface">
            <OfficeTab id="TabHome">
              <Group id="spectreGroup">
                <Label resid="Group.Label"/>
                <Icon>
                  <bt:Image size="16" resid="Icon.16"/>
                  <bt:Image size="32" resid="Icon.32"/>
                  <bt:Image size="80" resid="Icon.80"/>
                </Icon>
                <Control xsi:type="Button" id="spectreOpenTaskpane">
                  <Label resid="Open.Label"/>
                  <Supertip>
                    <Title resid="Open.Title"/>
                    <Description resid="Open.Tooltip"/>
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Icon.16"/>
                    <bt:Image size="32" resid="Icon.32"/>
                    <bt:Image size="80" resid="Icon.80"/>
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <TaskpaneId>SpectreTaskpane</TaskpaneId>
                    <SourceLocation resid="Taskpane.Url"/>
                  </Action>
                </Control>
              </Group>
            </OfficeTab>
          </ExtensionPoint>
        </DesktopFormFactor>
      </Host>
    </Hosts>

    <Resources>
      <bt:Images>
        <bt:Image id="Icon.16" DefaultValue="https://word.spectrelegal.app/assets/icon-16.png"/>
        <bt:Image id="Icon.32" DefaultValue="https://word.spectrelegal.app/assets/icon-32.png"/>
        <bt:Image id="Icon.80" DefaultValue="https://word.spectrelegal.app/assets/icon-80.png"/>
      </bt:Images>
      <bt:Urls>
        <bt:Url id="Commands.Url" DefaultValue="https://word.spectrelegal.app/src/commands/commands.html"/>
        <bt:Url id="Taskpane.Url" DefaultValue="https://word.spectrelegal.app/src/taskpane/index.html"/>
        <bt:Url id="GetStarted.LearnMoreUrl" DefaultValue="https://support.spectrelegal.app"/>
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="Group.Label" DefaultValue="Spectre">
          <bt:Override Locale="en-US" Value="Spectre"/>
        </bt:String>
        <bt:String id="Open.Label" DefaultValue="Otwórz Spectre">
          <bt:Override Locale="en-US" Value="Open Spectre"/>
        </bt:String>
        <bt:String id="Open.Title" DefaultValue="Spectre — drafty i umowy">
          <bt:Override Locale="en-US" Value="Spectre — drafting &amp; contracts"/>
        </bt:String>
        <bt:String id="GetStarted.Title" DefaultValue="Spectre jest gotowe do pracy">
          <bt:Override Locale="en-US" Value="Spectre is ready"/>
        </bt:String>
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="Open.Tooltip" DefaultValue="Otwórz panel Spectre: generuj drafty z kontekstu sprawy, wypełniaj szablony i nanoś poprawki AI.">
          <bt:Override Locale="en-US" Value="Open the Spectre pane: generate drafts from case context, fill templates, and apply AI edits."/>
        </bt:String>
        <bt:String id="GetStarted.Description" DefaultValue="Kliknij „Otwórz Spectre” na karcie Narzędzia główne, aby rozpocząć pracę z dokumentem.">
          <bt:Override Locale="en-US" Value="Click “Open Spectre” on the Home tab to start working with the document."/>
        </bt:String>
      </bt:LongStrings>
    </Resources>

    <!--
      SSO: Office.auth.getAccessToken mints an Azure AD token for this resource;
      the backend exchanges it for a Spectre bearer (same pattern as the Outlook
      add-in's /outlook/auth/exchange). No Mail.Read here — Word only needs the
      user identity scopes.
    -->
    <WebApplicationInfo>
      <Id>0937dbe5-072c-4ad7-bc27-a9e5b2f0685c</Id>
      <Resource>api://word.spectrelegal.app/0937dbe5-072c-4ad7-bc27-a9e5b2f0685c</Resource>
      <Scopes>
        <Scope>openid</Scope>
        <Scope>profile</Scope>
        <Scope>email</Scope>
        <Scope>User.Read</Scope>
      </Scopes>
    </WebApplicationInfo>
  </VersionOverrides>
</OfficeApp>
