// License: see LICENSE file at root directory of `master` branch

//! # Bailamos
//!
//! ## Project
//!
//! - Repository: <https://bitbucket.org/haibison/bailamos>
//! - License: Nice License 1.0.0 _(see LICENSE file at root directory of `master` branch)_
//! - _This project follows [Semantic Versioning 2.0.0]_
//!
//! ## Features
//!
//! This project provides:
//!
//! - A server program with basic manager for users and notifications.
//! - A client library for other projects to communicate with the server.
//!
//! A simple specification of remote procedure call will be made when the project reaches stable release. That could help projects in other
//! languages.
//!
//! Please note that this project strictly follows [Semantic Versioning 2.0.0]. In early development state, it's expected to be changed
//! frequently. So currently it's not recommended to use the project in production.
//!
//! ## Server
//!
//! Server is available via `server` feature. You can pass `help` command to the program to view detailed documentation.
//!
//! ## Client
//!
//! Please refer to [`rpc`][::rpc].
//!
//! [Semantic Versioning 2.0.0]: https://semver.org/spec/v2.0.0.html
//! [::rpc]: rpc/index.html

#![warn(missing_docs)]

// ╔═════════════════╗
// ║   IDENTIFIERS   ║
// ╚═════════════════╝

macro_rules! code_name  { () => { "bailamos" }}
macro_rules! version    { () => { "0.10.0" }}

/// # Crate name
pub const NAME: &str = "Bailamos";

/// # Crate code name
pub const CODE_NAME: &str = code_name!();

/// # ID of this crate
pub const ID: &str = concat!(
    "9a8f6277-c826c781-adb4e4be-72672692-cbc02779-c5610554-3c546676-772900ae-",
    "57519250-a76bd747-e74d9f5c-38e87af5-cf2a35e5-cb6f9aa9-40b1ae26-3dff4a48",
);

/// # Crate version
pub const VERSION: &str = version!();

/// # Crate release date (year/month/day)
pub const RELEASE_DATE: (u16, u8, u8) = (2020, 1, 1);

/// # Tag, which can be used for logging...
pub const TAG: &str = concat!(code_name!(), "::9a8f6277::", version!());

// ╔════════════════════╗
// ║   IMPLEMENTATION   ║
// ╚════════════════════╝

pub mod db;
pub mod rpc;
pub mod version_info;

/// # Result type used in this crate
pub type Result<T> = std::io::Result<T>;

#[test]
fn test_crate_version() {
    assert_eq!(VERSION, env!("CARGO_PKG_VERSION"));
}

/// # Certificate, in PKCS #12 format
pub const CERT_P12: &[u8] = include_bytes!("../res/certs/cert.p12");

/// # Certificate's passphrase
pub const CERT_P12_PASSPHRASE: &str = include_str!("../res/certs/cert.p12.passphrase");

#[test]
fn test_cert() {
    assert_eq!(CERT_P12_PASSPHRASE, CERT_P12_PASSPHRASE.trim());
}
