<?xml version="1.0" encoding="UTF-8"?>
<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"
  xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0"
  xsi:type="MailApp">

  <!-- Vygeneruj vlastni GUID: `uuidgen` a vloz sem -->
  <Id>d31d6366-f058-4d46-89e1-41e98fe96b32</Id>
  <Version>1.0.0.0</Version>
  <ProviderName>Budova Access</ProviderName>
  <DefaultLocale>cs-CZ</DefaultLocale>
  <DisplayName DefaultValue="QR pristup do budovy" />
  <Description DefaultValue="Posle ucastnikum schuzky QR kod pro vstup do budovy." />
  <IconUrl DefaultValue="https://qrcal1.qrentry.app/assets/icon-80.png" />
  <HighResolutionIconUrl DefaultValue="https://qrcal1.qrentry.app/assets/icon-128.png" />
  <SupportUrl DefaultValue="https://qrcal1.qrentry.app" />

  <!-- Domena backendu, na ktery add-in vola -->
  <AppDomains>
    <AppDomain>https://qrcal1.qrentry.app</AppDomain>
  </AppDomains>

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

  <Requirements>
    <Sets>
      <Set Name="Mailbox" MinVersion="1.5" />
    </Sets>
  </Requirements>

  <FormSettings>
    <Form xsi:type="ItemRead">
      <DesktopSettings>
        <SourceLocation DefaultValue="https://qrcal1.qrentry.app/taskpane.html" />
        <RequestedHeight>250</RequestedHeight>
      </DesktopSettings>
    </Form>
  </FormSettings>

  <Permissions>ReadWriteItem</Permissions>

  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Read" />
    <Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Edit" />
  </Rule>

  <DisableEntityHighlighting>false</DisableEntityHighlighting>

  <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Requirements>
      <bt:Sets DefaultMinVersion="1.5">
        <bt:Set Name="Mailbox" />
      </bt:Sets>
    </Requirements>

    <Hosts>
      <Host xsi:type="MailHost">
        <DesktopFormFactor>
          <FunctionFile resid="Commands.Url" />

          <!-- Tlacitko na ribbonu pri uprave schuzky (organizator) -->
          <ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
            <OfficeTab id="TabDefault">
              <Group id="qrGroup">
                <Label resid="GroupLabel" />
                <Control xsi:type="Button" id="sendQrButton">
                  <Label resid="SendQr.Label" />
                  <Supertip>
                    <Title resid="SendQr.Label" />
                    <Description resid="SendQr.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">
                    <SourceLocation resid="Taskpane.Url" />
                  </Action>
                </Control>
              </Group>
            </OfficeTab>
          </ExtensionPoint>

          <!--
            VOLITELNE (vyzaduje Mailbox 1.13+): event-based aktivace, ktera spusti
            handler pri odeslani/uprave schuzky organizatorem. POZOR: zruseni schuzky
            tudy nejde spolehlive zachytit - na reschedule/cancel pouzij Graph webhook
            na backendu (viz backend/server.js). Po overeni verze odkomentuj:

          <ExtensionPoint xsi:type="LaunchEvent">
            <LaunchEvents>
              <LaunchEvent Type="OnAppointmentSend" FunctionName="onAppointmentSendHandler" SendMode="PromptUser" />
            </LaunchEvents>
            <SourceLocation resid="Commands.Url" />
          </ExtensionPoint>
          -->
        </DesktopFormFactor>
      </Host>
    </Hosts>

    <Resources>
      <bt:Images>
        <bt:Image id="Icon.16" DefaultValue="https://qrcal1.qrentry.app/assets/icon-16.png" />
        <bt:Image id="Icon.32" DefaultValue="https://qrcal1.qrentry.app/assets/icon-32.png" />
        <bt:Image id="Icon.80" DefaultValue="https://qrcal1.qrentry.app/assets/icon-80.png" />
      </bt:Images>
      <bt:Urls>
        <bt:Url id="Commands.Url" DefaultValue="https://qrcal1.qrentry.app/commands.html" />
        <bt:Url id="Taskpane.Url" DefaultValue="https://qrcal1.qrentry.app/taskpane.html" />
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="GroupLabel" DefaultValue="QR pristup" />
        <bt:String id="SendQr.Label" DefaultValue="Poslat QR ucastnikum" />
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="SendQr.Tooltip" DefaultValue="Vygeneruje a rozesle ucastnikum QR kod pro vstup do budovy." />
      </bt:LongStrings>
    </Resources>
  </VersionOverrides>
</OfficeApp>
