/*
==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--

Namaste

Copyright (C) 2019, 2021-2023  Anonymous

There are several releases over multiple years,
they are listed as ranges, such as: "2021-2023".

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser 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 Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--::--
*/

use {
    core::time::Duration,
    std::{
        io::{self, Write},
        thread,
    },
    namaste::Result,
};

const ID: &[u8] = &[
    0xde, 0x91, 0xf0, 0x29, 0xc9, 0x32, 0x58, 0x3e, 0x70, 0xca, 0x71, 0xa6, 0x23, 0xb9, 0x94, 0x19, 0xcb, 0x29, 0x2d, 0xd0, 0x08, 0xd6, 0x01,
    0xc8, 0x05, 0x17, 0x93, 0xba, 0xb6, 0x46, 0x28, 0x96, 0x5d, 0x24, 0x19, 0x7e, 0x7e, 0xc6, 0x4d, 0xe4, 0x47, 0x71, 0x59, 0x4d, 0x0e, 0x4c,
    0x1a, 0x61, 0xe5, 0xa0, 0xbf, 0x0a, 0x7c, 0xf1, 0xc8, 0x88, 0xd7, 0x54, 0x26, 0x7f, 0x2f, 0x36, 0xea, 0x2e,
];

const SLEEP: Duration = Duration::from_secs(600);

fn main() -> Result<()> {
    io::stdout().lock().write_all(b"This is a test program.\n")?;

    let _namaste = namaste::make(ID)?;
    io::stdout().lock().write_all(format!("Locked. Unlocking in: {:?}\n", SLEEP).as_bytes())?;
    thread::sleep(SLEEP);

    io::stdout().lock().write_all(b"Ok\n")
}
