/*
 * Copyright (C) 2025-2026  Tim Zimmermann <tim@aglais.org>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.aglais.zms.api.core;

import org.aglais.zms.util.VersionUtil;

/**
 * Class holding constants shared by both API client and server
 */
public class APIConstants {

    /**
     * The project's public name
     */
    public static final String PROJECT_NAME = "Aglais ZMS";
    /**
     * The project's public name without any spaces
     */
    public static final String PROJECT_NAME_NO_SPACES = PROJECT_NAME.replaceAll(" ", "");
    /**
     * The project's public name without any spaces and only lowercase characters
     */
    public static final String PROJECT_NAME_LOWERCASE_NO_SPACES = PROJECT_NAME.toLowerCase().replaceAll(" ", "-");

    /**
     * The user agent to use for client/server communication
     */
    public static final String USER_AGENT = PROJECT_NAME + "/" + VersionUtil.getVersion();

    /**
     * The currently supported API version
     */
    public static final int API_VERSION_CURRENT = 1;
    /**
     * The minimum currently supported API version
     */
    public static final int API_VERSION_MIN = API_VERSION_CURRENT;

    /**
     * Header containing the client's API version
     */
    public static final String X_AGLAIS_ZMS_API_VERSION = "X-Aglais-ZMS-API-Version";

    /**
     * The magic to be expected to be returned by {@link #URL_API_HEALTH_CHECK}
     */
    public static final String API_HEALTH_CHECK_MAGIC = "Built to preserve";

    /**
     * API URL to check if connection is authenticated
     * <br/>
     * Request method: GET
     */
    public static final String URL_API_HEALTH_CHECK = "/api/health/check";
    /**
     * API URL to get the currently supported API version
     * <br/>
     * Request method: GET
     */
    public static final String URL_API_VERSION_CURRENT = "/api/version/current";
    /**
     * API URL to get the minimum currently supported API version
     * <br/>
     * Requeset method: GET
     */
    public static final String URL_API_VERSION_MIN = "/api/version/min";
    /**
     * API URL to get own user
     * <br/>
     * Request method: GET
     */
    public static final String URL_API_USER_SELF = "/api/user/self";
    /**
     * DB URL to get database version
     * <br/>
     * Request method: GET
     */
    public static final String URL_DB_VERSION = "/db/version/current";
    /**
     * DB URL to get required database version
     * <br/>
     * Request method: GET
     */
    public static final String URL_DB_REQUIRED_VERSION = "/db/version/required";
    /**
     * DB URL to upgrade the database
     * <br/>
     * Request method: POST
     */
    public static final String URL_DB_UPGRADE = "/db/upgrade";
    /**
     * DB URL to add a species
     * <br/>
     * Request method: POST
     */
    public static final String URL_DB_ADD_SPECIES = "/db/species/add";
    /**
     * DB URL to get all species
     * <br/>
     * Request method: GET
     */
    public static final String URL_DB_ALL_SPECIES = "/db/species/list";
    /**
     * DB URL to delete a species
     * <br/>
     * Request method: POST
     */
    public static final String URL_DB_DELETE_SPECIES = "/db/species/delete";
    /**
     * DB URL to update a species
     * <br/>
     * Request method: PUT
     */
    public static final String URL_DB_UPDATE_SPECIES = "/db/species/update";
    /**
     * DB URL to get species ancestry
     * <br/>
     * Request method: POST
     */
    public static final String URL_DB_SPECIES_ANCESTRY = "/db/species/ancestry";
    /**
     * DB URL to update species ancestry
     * <br/>
     * Request method: PUT
     */
    public static final String URL_DB_UPDATE_SPECIES_ANCESTRY = "/db/species/ancestry/update";
    /**
     * DB URL to add a user
     * <br/>
     * Request method: POST
     */
    public static final String URL_DB_ADD_USER = "/db/user/add";
    /**
     * DB URL to get all suers
     * <br/>
     * Request method: GET
     */
    public static final String URL_DB_ALL_USERS = "/db/user/list";
    /**
     * DB URL to delete a user
     * <br/>
     * Request method: POST
     */
    public static final String URL_DB_DELETE_USER = "/db/user/delete";
    /**
     * DB URL to update a user
     * <br/>
     * Request method: PUT
     */
    public static final String URL_DB_UPDATE_USER = "/db/user/update";
    /**
     * DB URL to get a user by name
     * <br/>
     * Request method: POST
     */
    public static final String URL_DB_USER_BY_NAME = "/db/user/by/name";
    /**
     * DB URL to get a user by ID
     * <br/>
     * Request method: POST
     */
    public static final String URL_DB_USER_BY_ID = "/db/user/by/id";

}
