labscript 0.1.0

Prescription PDF generator with e-signature and QR verification
use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(
    name = "labscript",
    version,
    about = "Prescription PDF generator with e-signature and QR verification"
)]
pub struct Cli {
    /// Force JSON output (default when piped)
    #[arg(long, global = true)]
    pub json: bool,

    #[command(subcommand)]
    pub command: Commands,
}

#[derive(Subcommand)]
pub enum Commands {
    /// Generate a prescription PDF
    Generate {
        // ── Patient fields ──
        /// Patient full name
        #[arg(long)]
        patient_name: Option<String>,

        /// Patient date of birth (YYYY-MM-DD)
        #[arg(long)]
        patient_dob: Option<String>,

        /// Patient address
        #[arg(long)]
        patient_address: Option<String>,

        // ── Prescriber fields ──
        /// Prescriber name
        #[arg(long)]
        prescriber_name: Option<String>,

        /// Prescriber credentials (e.g. "MD, PhD")
        #[arg(long)]
        prescriber_credentials: Option<String>,

        /// Prescriber license number
        #[arg(long)]
        prescriber_license: Option<String>,

        /// Prescriber address
        #[arg(long)]
        prescriber_address: Option<String>,

        // ── Medication fields (single medication via CLI) ──
        /// Drug name
        #[arg(long)]
        drug: Option<String>,

        /// Drug strength (e.g. "500mg")
        #[arg(long)]
        strength: Option<String>,

        /// Drug form (e.g. "tablet")
        #[arg(long)]
        form: Option<String>,

        /// Quantity to dispense
        #[arg(long)]
        quantity: Option<u32>,

        /// Sig (directions for use)
        #[arg(long)]
        sig: Option<String>,

        /// Number of refills
        #[arg(long)]
        refills: Option<u32>,

        // ── Optional fields ──
        /// Diagnosis
        #[arg(long)]
        diagnosis: Option<String>,

        /// Additional notes
        #[arg(long)]
        notes: Option<String>,

        /// Prescription date (YYYY-MM-DD, defaults to today)
        #[arg(long)]
        date: Option<String>,

        /// Path to signature image (PNG)
        #[arg(long)]
        signature: Option<String>,

        /// Output PDF file path
        #[arg(long, default_value = "prescription.pdf")]
        output: String,

        /// Read prescription from JSON file
        #[arg(long)]
        file: Option<String>,

        /// Read prescription JSON from stdin
        #[arg(long)]
        stdin: bool,
    },

    /// Verify a QR code from a scanned prescription
    Verify {
        /// QR code string (labscript:v1:uuid:hash:timestamp)
        qr_string: String,
    },

    /// Show agent-info for AI consumption
    AgentInfo,
}