<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Version: 1.0
  ~
  ~ The contents of this file are subject to the OpenVPMS License Version
  ~ 1.0 (the 'License'); you may not use this file except in compliance with
  ~ the License. You may obtain a copy of the License at
  ~ http://www.openvpms.org/license/
  ~
  ~ Software distributed under the License is distributed on an 'AS IS' basis,
  ~ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  ~ for the specific language governing rights and limitations under the
  ~ License.
  ~
  ~ Copyright 2025 (C) OpenVPMS Ltd. All Rights Reserved.
  -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>openvpms-plugins</artifactId>
        <groupId>org.openvpms</groupId>
        <version>2.4.0.12.4</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>deputy-openvpms-plugin</artifactId>
    <name>Deputy OpenVPMS plugin</name>
    <packaging>bundle</packaging>

    <dependencies>
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-mapping-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-domain-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-plugin-services</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-ws-util</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.cmpn</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- NOTE: the following dependencies are embedded to work around  -->
        <!-- https://openvpms.atlassian.net/browse/OVPMS-2200              -->
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-rest-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-ws-util</artifactId>
        </dependency>

        <!-- test dependencies -->
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-archetypes</artifactId>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openvpms</groupId>
            <artifactId>openvpms-plugin-services-impl</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.bundles</groupId>
            <artifactId>org.apache.servicemix.bundles.spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-dbcp2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>${jdbc.groupId}</groupId>
            <artifactId>${jdbc.artifactId}</artifactId>
            <version>${jdbc.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.tomakehurst</groupId>
            <artifactId>wiremock</artifactId>
            <scope>test</scope>
            <classifier>standalone</classifier>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
                <includes>
                    <include>**/*.adl</include>
                    <include>**/*.properties</include>
                </includes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>${basedir}/src/test/resources</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.openvpms</groupId>
                <artifactId>openvpms-archetype-maven-plugin</artifactId>
                <version>${project.version}</version>
                <configuration>
                    <dir>src/main/resources</dir>
                    <driver>${build.jdbc.driverClassName}</driver>
                    <url>${build.jdbc.url}</url>
                    <username>${build.jdbc.username}</username>
                    <password>${build.jdbc.password}</password>
                    <skip>${skipTests}</skip>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>load</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>${jdbc.groupId}</groupId>
                        <artifactId>${jdbc.artifactId}</artifactId>
                        <version>${jdbc.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <exportScr>true</exportScr>
                    <instructions>
                        <Atlassian-Plugin-Key>${project.groupId}.${project.artifactId}</Atlassian-Plugin-Key>
                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId};singleton:=true
                        </Bundle-SymbolicName>
                        <Bundle-RequiredExecutionEnvironment>JavaSE-1.8</Bundle-RequiredExecutionEnvironment>
                        <Export-Package>org.openvpms.deputy.service;version="${project.version}"
                        </Export-Package>
                        <Import-Package>
                            org.openvpms.component.model.archetype,
                            org.openvpms.component.model.act,
                            org.openvpms.component.model.bean,
                            org.openvpms.component.model.entity,
                            org.openvpms.component.model.object,
                            org.openvpms.component.model.lookup,
                            org.openvpms.component.model.party,
                            org.openvpms.component.model.product,
                            org.openvpms.component.model.user,
                            org.openvpms.component.exception,
                            org.openvpms.component.i18n,
                            org.openvpms.component.service.archetype,
                            org.openvpms.component.query,
                            org.openvpms.component.query.criteria,
                            org.openvpms.component.security.crypto,
                            org.openvpms.mapping.exception,
                            org.openvpms.mapping.model,
                            org.openvpms.mapping.service,
                            org.openvpms.plugin.service.archetype,
                            org.openvpms.plugin.service.config,
                            org.openvpms.plugin.service.util,
                            org.openvpms.plugin.service.version,
                            javax.activation.*,
                            javax.annotation.*;version="[1,2)", <!-- needed by org.glassfish.jersey.internal.RuntimeDelegateImpl -->
                            javax.inject.*,
                            javax.persistence.*,
                            javax.xml.*,
                            javax.net.*,
                            org.apache.commons.lang3.*,
                            org.apache.commons.io.*,
                            org.slf4j,
                            org.w3c.dom.*,
                            org.xml.sax.*
                        </Import-Package>
                        <!-- NOTE: javax.activation should be: javax.activation.*;version="[1.1,2)", -->
                        <!-- this gets modified by APF                                               -->
                        <Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
                        <Embed-Transitive>false</Embed-Transitive>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>