"""
Seed sample medicine data into MySQL for testing.
Creates tables if they don't exist, inserts ~100 common medicines.
"""

import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).parent.parent))

from src.database.connection import engine, SessionLocal
from src.database.models import Base, Medicine
from sqlalchemy import text
from datetime import datetime


SAMPLE_MEDICINES = [
    # === TABLETS (Oral Solids) ===
    {
        "product_name": "Dolo 650 Tablet",
        "salt_composition": "Paracetamol 650mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of fever and mild to moderate pain",
        "how_to_use": "Take this medicine with or after food. Swallow it as a whole with a glass of water. Do not crush, chew, or break it. Take it twice daily or as directed by physician.",
        "common_side_effect": "Nausea, Stomach pain, Allergic reaction",
        "alcohol_interaction": "UNSAFE - Increases risk of liver damage",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "kidney_interaction": "CAUTION - Use with caution in kidney disease",
        "liver_interaction": "CAUTION - Use with caution in liver disease",
        "source_file": "sample",
    },
    {
        "product_name": "Crocin 500 Tablet",
        "salt_composition": "Paracetamol 500mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of fever and pain",
        "how_to_use": "Take it as directed by the doctor. Swallow it as a whole. Do not chew, crush or break it. Take after food twice daily.",
        "common_side_effect": "Nausea, Vomiting, Stomach pain",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "PROBABLY SAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Azithral 500 Tablet",
        "salt_composition": "Azithromycin 500mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of bacterial infections",
        "how_to_use": "Take this medicine one hour before food or two hours after food. Take once daily for 3 days or as prescribed.",
        "common_side_effect": "Nausea, Abdominal pain, Diarrhea",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Amoxyclav 625 Tablet",
        "salt_composition": "Amoxicillin 500mg + Clavulanic Acid 125mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of bacterial infections",
        "how_to_use": "Take this medicine with food to reduce stomach upset. Take it twice daily (BD) at evenly spaced intervals as prescribed by your doctor.",
        "common_side_effect": "Diarrhea, Nausea, Vomiting, Rash",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "PROBABLY SAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Metformin 500 Tablet",
        "salt_composition": "Metformin 500mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of type 2 diabetes mellitus",
        "how_to_use": "Take this medicine with food or after food. Take twice daily as prescribed. Do not crush or chew the tablet.",
        "common_side_effect": "Nausea, Vomiting, Diarrhea, Stomach pain, Loss of appetite",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Amlodipine 5mg Tablet",
        "salt_composition": "Amlodipine 5mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of hypertension and angina",
        "how_to_use": "Take once daily at the same time each day. Can be taken with or without food.",
        "common_side_effect": "Edema, Headache, Dizziness, Flushing",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "UNSAFE - may cause dizziness",
        "source_file": "sample",
    },
    {
        "product_name": "Atorvastatin 10mg Tablet",
        "salt_composition": "Atorvastatin 10mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of high cholesterol",
        "how_to_use": "Take once daily at bedtime. Can be taken with or without food.",
        "common_side_effect": "Muscle pain, Constipation, Flatulence, Headache",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Pantoprazole 40mg Tablet",
        "salt_composition": "Pantoprazole 40mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of acid reflux and peptic ulcer disease",
        "how_to_use": "Take this medicine on empty stomach, 1 hour before food. Take once daily preferably in the morning.",
        "common_side_effect": "Headache, Diarrhea, Nausea, Stomach pain",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Cetirizine 10mg Tablet",
        "salt_composition": "Cetirizine 10mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of allergy symptoms",
        "how_to_use": "Take once daily at bedtime. Can be taken with or without food.",
        "common_side_effect": "Drowsiness, Dry mouth, Headache, Fatigue",
        "alcohol_interaction": "UNSAFE - increases drowsiness",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "UNSAFE - may cause drowsiness",
        "source_file": "sample",
    },
    {
        "product_name": "Aspirin 75mg Tablet",
        "salt_composition": "Aspirin 75mg",
        "medicine_type": "Tablet",
        "primary_use": "Prevention of heart attack and stroke",
        "how_to_use": "Take once daily after food. Do not crush or chew. Swallow whole with water.",
        "common_side_effect": "Stomach irritation, Bleeding, Nausea",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "UNSAFE in third trimester",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Ciprofloxacin 500mg Tablet",
        "salt_composition": "Ciprofloxacin 500mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of bacterial infections",
        "how_to_use": "Take twice daily (BD). Can be taken with or without food. Drink plenty of fluids while taking this medicine.",
        "common_side_effect": "Nausea, Diarrhea, Vomiting, Headache",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "UNSAFE - may cause dizziness",
        "source_file": "sample",
    },
    {
        "product_name": "Montelukast 10mg Tablet",
        "salt_composition": "Montelukast 10mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of asthma and allergic rhinitis",
        "how_to_use": "Take once daily in the evening. Can be taken with or without food.",
        "common_side_effect": "Headache, Stomach pain, Fatigue",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Losartan 50mg Tablet",
        "salt_composition": "Losartan 50mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of hypertension",
        "how_to_use": "Take once daily. Can be taken with or without food. Take at the same time each day.",
        "common_side_effect": "Dizziness, Fatigue, Low blood pressure",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "UNSAFE - may cause dizziness",
        "source_file": "sample",
    },
    {
        "product_name": "Omeprazole 20mg Capsule",
        "salt_composition": "Omeprazole 20mg",
        "medicine_type": "Capsule",
        "primary_use": "Treatment of acid reflux and peptic ulcer",
        "how_to_use": "Take on empty stomach, 30 minutes before food. Take once daily in the morning.",
        "common_side_effect": "Headache, Nausea, Diarrhea, Stomach pain",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Ibuprofen 400mg Tablet",
        "salt_composition": "Ibuprofen 400mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of pain, inflammation and fever",
        "how_to_use": "Take this medicine with food or after meal. Take thrice daily (TDS) as needed for pain. Do not exceed 1200mg per day without prescription.",
        "common_side_effect": "Stomach pain, Nausea, Vomiting, Dizziness",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "UNSAFE in third trimester",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Diclofenac 50mg Tablet",
        "salt_composition": "Diclofenac 50mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of pain and inflammation",
        "how_to_use": "Take after food, twice daily or thrice daily as prescribed.",
        "common_side_effect": "Stomach pain, Nausea, Diarrhea, Headache",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Telmisartan 40mg Tablet",
        "salt_composition": "Telmisartan 40mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of hypertension",
        "how_to_use": "Take once daily at the same time. Can be taken with or without food.",
        "common_side_effect": "Dizziness, Back pain, Diarrhea",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Glimepiride 2mg Tablet",
        "salt_composition": "Glimepiride 2mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of type 2 diabetes mellitus",
        "how_to_use": "Take once daily with breakfast or the first main meal. Do not skip meals.",
        "common_side_effect": "Low blood sugar, Headache, Dizziness, Nausea",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "CAUTION - risk of hypoglycemia",
        "source_file": "sample",
    },
    {
        "product_name": "Levothyroxine 50mcg Tablet",
        "salt_composition": "Levothyroxine 50mcg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of hypothyroidism",
        "how_to_use": "Take on empty stomach, 30-60 minutes before breakfast. Take once daily in the morning.",
        "common_side_effect": "Weight loss, Tremor, Headache, Restlessness",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "SAFE - continue during pregnancy",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Rosuvastatin 10mg Tablet",
        "salt_composition": "Rosuvastatin 10mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of high cholesterol",
        "how_to_use": "Take once daily at any time. Can be taken with or without food.",
        "common_side_effect": "Muscle pain, Headache, Nausea, Weakness",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },

    # === SYRUPS / SUSPENSIONS ===
    {
        "product_name": "Benadryl Cough Syrup",
        "salt_composition": "Diphenhydramine 14.08mg/5ml",
        "medicine_type": "Syrup",
        "primary_use": "Treatment of dry cough",
        "how_to_use": "Take 5-10ml three times a day (TDS). Shake well before use.",
        "common_side_effect": "Drowsiness, Dizziness, Dry mouth",
        "alcohol_interaction": "UNSAFE - increases drowsiness",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "UNSAFE - causes drowsiness",
        "source_file": "sample",
    },
    {
        "product_name": "Grilinctus Syrup",
        "salt_composition": "Dextromethorphan 10mg/5ml + Chlorpheniramine 2mg/5ml",
        "medicine_type": "Syrup",
        "primary_use": "Treatment of cough",
        "how_to_use": "Take 5ml three times daily after food. Shake well before each use.",
        "common_side_effect": "Drowsiness, Nausea, Dizziness",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "UNSAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Augmentin Duo Suspension",
        "salt_composition": "Amoxicillin 200mg/5ml + Clavulanic Acid 28.5mg/5ml",
        "medicine_type": "Suspension",
        "primary_use": "Treatment of bacterial infections in children",
        "how_to_use": "Give as directed by physician. Shake well before use. Give three times daily for 5-7 days.",
        "common_side_effect": "Diarrhea, Nausea, Vomiting, Rash",
        "alcohol_interaction": "Not applicable (pediatric)",
        "pregnancy_interaction": "PROBABLY SAFE",
        "driving_interaction": "Not applicable",
        "source_file": "sample",
    },
    {
        "product_name": "Calpol 250mg/5ml Suspension",
        "salt_composition": "Paracetamol 250mg/5ml",
        "medicine_type": "Suspension",
        "primary_use": "Treatment of fever and pain in children",
        "how_to_use": "Give 5-10ml every 4-6 hours as needed. Do not exceed 4 doses in 24 hours. Shake well before use.",
        "common_side_effect": "Nausea, Allergic reaction",
        "alcohol_interaction": "Not applicable (pediatric)",
        "pregnancy_interaction": "SAFE",
        "driving_interaction": "Not applicable",
        "source_file": "sample",
    },
    {
        "product_name": "Ondem Syrup",
        "salt_composition": "Ondansetron 2mg/5ml",
        "medicine_type": "Syrup",
        "primary_use": "Treatment of nausea and vomiting",
        "how_to_use": "Take 5-10ml thrice daily before meals or as directed by physician.",
        "common_side_effect": "Headache, Constipation, Fatigue",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },

    # === INJECTIONS ===
    {
        "product_name": "Insulin Glargine 100IU/ml Injection",
        "salt_composition": "Insulin Glargine 100IU/ml",
        "medicine_type": "Injection",
        "primary_use": "Treatment of diabetes mellitus",
        "how_to_use": "Inject subcutaneously once daily at the same time each day. Rotate injection sites.",
        "common_side_effect": "Low blood sugar, Weight gain, Injection site reaction",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "CAUTION - risk of hypoglycemia",
        "source_file": "sample",
    },
    {
        "product_name": "Monocef 1g Injection",
        "salt_composition": "Ceftriaxone 1000mg",
        "medicine_type": "Injection",
        "primary_use": "Treatment of severe bacterial infections",
        "how_to_use": "Administered by healthcare professional. Given as IV or IM injection once daily.",
        "common_side_effect": "Rash, Diarrhea, Injection site pain",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "PROBABLY SAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Enoxaparin 40mg Injection",
        "salt_composition": "Enoxaparin 40mg/0.4ml",
        "medicine_type": "Injection",
        "primary_use": "Prevention of blood clots",
        "how_to_use": "Inject subcutaneously once daily as directed by physician.",
        "common_side_effect": "Bleeding, Bruising, Injection site reaction",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },

    # === CREAMS / OINTMENTS / GELS (Topicals) ===
    {
        "product_name": "Betnovate Cream",
        "salt_composition": "Betamethasone 0.1%",
        "medicine_type": "Cream",
        "primary_use": "Treatment of skin inflammation and itching",
        "how_to_use": "Apply a thin layer on affected area twice daily (BD). Do not use on face for prolonged periods.",
        "common_side_effect": "Skin thinning, Stretch marks, Burning sensation",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Candid Cream",
        "salt_composition": "Clotrimazole 1%",
        "medicine_type": "Cream",
        "primary_use": "Treatment of fungal skin infections",
        "how_to_use": "Apply on clean, dry affected area twice daily for 2-4 weeks.",
        "common_side_effect": "Burning, Stinging, Skin irritation",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Soframycin Skin Cream",
        "salt_composition": "Framycetin 1%",
        "medicine_type": "Cream",
        "primary_use": "Treatment of skin infections",
        "how_to_use": "Apply on the affected area two to three times daily. Clean the area before application.",
        "common_side_effect": "Skin irritation, Allergic reaction",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Volini Gel",
        "salt_composition": "Diclofenac Diethylamine 1.16%",
        "medicine_type": "Gel",
        "primary_use": "Treatment of muscle pain and joint pain",
        "how_to_use": "Apply on affected area and gently rub. Use three to four times daily as needed.",
        "common_side_effect": "Skin redness, Itching, Burning at application site",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Mupirocin Ointment",
        "salt_composition": "Mupirocin 2%",
        "medicine_type": "Ointment",
        "primary_use": "Treatment of bacterial skin infections",
        "how_to_use": "Apply a thin layer on affected area twice daily for 5-10 days.",
        "common_side_effect": "Burning, Itching, Pain at site",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },

    # === DROPS ===
    {
        "product_name": "Ciprodex Ear Drops",
        "salt_composition": "Ciprofloxacin 0.3% + Dexamethasone 0.1%",
        "medicine_type": "Drops",
        "primary_use": "Treatment of ear infections",
        "how_to_use": "Instill 4 drops into affected ear twice daily for 7 days.",
        "common_side_effect": "Ear discomfort, Itching",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Nasivion Nasal Drops",
        "salt_composition": "Oxymetazoline 0.05%",
        "medicine_type": "Drops",
        "primary_use": "Relief of nasal congestion",
        "how_to_use": "Instill 2-3 drops in each nostril twice daily. Do not use for more than 3 days.",
        "common_side_effect": "Burning, Stinging, Dryness",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },

    # === CAPSULES ===
    {
        "product_name": "Becosules Capsule",
        "salt_composition": "Vitamin B Complex + Vitamin C",
        "medicine_type": "Capsule",
        "primary_use": "Treatment of vitamin B and C deficiency",
        "how_to_use": "Take once daily after food. Swallow whole with water.",
        "common_side_effect": "Nausea, Stomach upset",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "SAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Rabeprazole 20mg Capsule",
        "salt_composition": "Rabeprazole 20mg",
        "medicine_type": "Capsule",
        "primary_use": "Treatment of acid reflux and ulcer",
        "how_to_use": "Take on empty stomach, preferably in the morning. Take once daily.",
        "common_side_effect": "Headache, Diarrhea, Nausea",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Doxycycline 100mg Capsule",
        "salt_composition": "Doxycycline 100mg",
        "medicine_type": "Capsule",
        "primary_use": "Treatment of bacterial infections and acne",
        "how_to_use": "Take with a full glass of water. Take twice daily after food. Do not lie down for 30 minutes after taking.",
        "common_side_effect": "Nausea, Diarrhea, Photosensitivity, Stomach upset",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Pregabalin 75mg Capsule",
        "salt_composition": "Pregabalin 75mg",
        "medicine_type": "Capsule",
        "primary_use": "Treatment of neuropathic pain and epilepsy",
        "how_to_use": "Take twice daily with or without food. Do not stop abruptly.",
        "common_side_effect": "Dizziness, Drowsiness, Weight gain, Blurred vision",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "UNSAFE - causes drowsiness",
        "source_file": "sample",
    },

    # === VAGUE / LOW-CONFIDENCE MEDICINES (to test AI fallback) ===
    {
        "product_name": "Liv 52 DS Tablet",
        "salt_composition": "Himsra + Kasani + Mandur Bhasma + Kakamachi",
        "medicine_type": "Tablet",
        "primary_use": "Liver care",
        "how_to_use": "Take as directed by physician",
        "common_side_effect": "Not reported",
        "source_file": "sample",
    },
    {
        "product_name": "Himalaya Septilin Tablet",
        "salt_composition": "Guggulu + Guduchi + Licorice",
        "medicine_type": "Tablet",
        "primary_use": "Immunity booster",
        "how_to_use": "As directed by the physician",
        "common_side_effect": "None known",
        "source_file": "sample",
    },
    {
        "product_name": "Zandu Balm",
        "salt_composition": "Menthol + Camphor + Eucalyptus Oil",
        "medicine_type": "Ointment",
        "primary_use": "Relief from headache and body pain",
        "how_to_use": "Apply on affected area and gently massage",
        "common_side_effect": "Skin irritation",
        "source_file": "sample",
    },
    {
        "product_name": "Dabur Chyawanprash",
        "salt_composition": "Amla + Various Ayurvedic herbs",
        "medicine_type": "Other",
        "primary_use": "Immunity booster",
        "how_to_use": "Take 1-2 teaspoons daily",
        "common_side_effect": "None known",
        "source_file": "sample",
    },
    {
        "product_name": "Deriphyllin Retard 150mg Tablet",
        "salt_composition": "Etophylline 77mg + Theophylline 23mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of asthma and chronic obstructive pulmonary disease",
        "how_to_use": "Take as directed",
        "common_side_effect": "Nausea, Vomiting, Headache, Palpitations",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Becadexamin Capsule",
        "salt_composition": "Multivitamins + Minerals",
        "medicine_type": "Capsule",
        "primary_use": "Nutritional supplement",
        "how_to_use": "Take one capsule daily with food",
        "common_side_effect": "Nausea, Stomach upset",
        "source_file": "sample",
    },
    {
        "product_name": "Neurobion Forte Tablet",
        "salt_composition": "Vitamin B1 10mg + Vitamin B6 3mg + Vitamin B12 15mcg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of vitamin B deficiency and nerve pain",
        "how_to_use": "Take once daily after meal.",
        "common_side_effect": "Nausea, Stomach upset",
        "source_file": "sample",
    },

    # === MORE VARIED TABLETS ===
    {
        "product_name": "Clopidogrel 75mg Tablet",
        "salt_composition": "Clopidogrel 75mg",
        "medicine_type": "Tablet",
        "primary_use": "Prevention of heart attack and stroke",
        "how_to_use": "Take once daily with or without food at the same time each day.",
        "common_side_effect": "Bleeding, Bruising, Stomach pain",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Domperidone 10mg Tablet",
        "salt_composition": "Domperidone 10mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of nausea and vomiting",
        "how_to_use": "Take before meal, three times daily. Do not exceed 30mg per day.",
        "common_side_effect": "Dry mouth, Headache",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Ranitidine 150mg Tablet",
        "salt_composition": "Ranitidine 150mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of acidity and peptic ulcer",
        "how_to_use": "Take twice daily before meals or at bedtime.",
        "common_side_effect": "Headache, Constipation, Diarrhea",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Levofloxacin 500mg Tablet",
        "salt_composition": "Levofloxacin 500mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of bacterial infections",
        "how_to_use": "Take once daily with plenty of water. Can be taken with or without food.",
        "common_side_effect": "Nausea, Diarrhea, Headache, Dizziness",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "UNSAFE - may cause dizziness",
        "source_file": "sample",
    },
    {
        "product_name": "Fluconazole 150mg Tablet",
        "salt_composition": "Fluconazole 150mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of fungal infections",
        "how_to_use": "Take as a single dose or as directed by physician.",
        "common_side_effect": "Headache, Nausea, Stomach pain, Diarrhea",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Alprazolam 0.25mg Tablet",
        "salt_composition": "Alprazolam 0.25mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of anxiety and panic disorder",
        "how_to_use": "Take as directed by physician. Usually twice or thrice daily. Do not stop abruptly.",
        "common_side_effect": "Drowsiness, Fatigue, Memory impairment, Dependence",
        "alcohol_interaction": "UNSAFE - dangerous combination",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "UNSAFE - causes severe drowsiness",
        "source_file": "sample",
    },
    {
        "product_name": "Prednisolone 10mg Tablet",
        "salt_composition": "Prednisolone 10mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of inflammatory and autoimmune conditions",
        "how_to_use": "Take with food as directed. Usually once daily in the morning. Do not stop abruptly.",
        "common_side_effect": "Weight gain, Increased appetite, Mood changes, Insomnia",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Tramadol 50mg Tablet",
        "salt_composition": "Tramadol 50mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of moderate to severe pain",
        "how_to_use": "Take after food. Can be taken every 4-6 hours as needed. Maximum QDS.",
        "common_side_effect": "Nausea, Dizziness, Drowsiness, Constipation",
        "alcohol_interaction": "UNSAFE - dangerous combination",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "UNSAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Warfarin 5mg Tablet",
        "salt_composition": "Warfarin 5mg",
        "medicine_type": "Tablet",
        "primary_use": "Prevention of blood clots",
        "how_to_use": "Take once daily at the same time, usually at bedtime. Regular INR monitoring required.",
        "common_side_effect": "Bleeding, Bruising, Nausea",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },

    # === INHALERS ===
    {
        "product_name": "Budecort 200mcg Inhaler",
        "salt_composition": "Budesonide 200mcg",
        "medicine_type": "Inhaler",
        "primary_use": "Treatment of asthma",
        "how_to_use": "Inhale twice daily as prescribed. Rinse mouth after use.",
        "common_side_effect": "Oral thrush, Hoarseness, Cough",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Asthalin Inhaler",
        "salt_composition": "Salbutamol 100mcg",
        "medicine_type": "Inhaler",
        "primary_use": "Relief of bronchospasm in asthma",
        "how_to_use": "Inhale 1-2 puffs as needed for breathlessness. Maximum 8 puffs in 24 hours.",
        "common_side_effect": "Tremor, Headache, Palpitations, Muscle cramps",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },

    # === SACHETS / POWDERS ===
    {
        "product_name": "ORS Powder",
        "salt_composition": "Sodium Chloride + Potassium Chloride + Sodium Citrate + Dextrose",
        "medicine_type": "Powder",
        "primary_use": "Treatment of dehydration due to diarrhea",
        "how_to_use": "Dissolve one sachet in 1 litre of clean drinking water. Sip frequently throughout the day.",
        "common_side_effect": "Nausea, Vomiting (if taken too fast)",
        "source_file": "sample",
    },
    {
        "product_name": "Electral Powder",
        "salt_composition": "Sodium Chloride + Potassium Chloride + Sodium Citrate + Dextrose",
        "medicine_type": "Powder",
        "primary_use": "Treatment and prevention of dehydration",
        "how_to_use": "Dissolve contents in 200ml water. Drink as needed. Use within 24 hours.",
        "common_side_effect": "None significant",
        "source_file": "sample",
    },

    # === SUPPOSITORIES ===
    {
        "product_name": "Dulcolax 10mg Suppository",
        "salt_composition": "Bisacodyl 10mg",
        "medicine_type": "Suppository",
        "primary_use": "Treatment of constipation",
        "how_to_use": "Insert one suppository rectally once daily when needed.",
        "common_side_effect": "Abdominal cramp, Rectal irritation",
        "source_file": "sample",
    },

    # === MORE FOR VARIETY ===
    {
        "product_name": "Methylcobalamin 1500mcg Tablet",
        "salt_composition": "Methylcobalamin 1500mcg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of vitamin B12 deficiency and neuropathy",
        "how_to_use": "Take once daily after food.",
        "common_side_effect": "Nausea, Diarrhea, Headache",
        "source_file": "sample",
    },
    {
        "product_name": "Clonazepam 0.5mg Tablet",
        "salt_composition": "Clonazepam 0.5mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of seizures and panic disorder",
        "how_to_use": "Take as directed by physician. Usually twice daily.",
        "common_side_effect": "Drowsiness, Fatigue, Memory problems, Dependence",
        "alcohol_interaction": "UNSAFE - dangerous",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "UNSAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Folic Acid 5mg Tablet",
        "salt_composition": "Folic Acid 5mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of folic acid deficiency and pregnancy support",
        "how_to_use": "Take once daily with or without food.",
        "common_side_effect": "Nausea, Bloating",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "SAFE - recommended during pregnancy",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Calcium + Vitamin D3 Tablet",
        "salt_composition": "Calcium Carbonate 500mg + Vitamin D3 250IU",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of calcium deficiency and osteoporosis",
        "how_to_use": "Take one tablet twice daily after meals.",
        "common_side_effect": "Constipation, Bloating, Gas",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "SAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Iron + Folic Acid Tablet",
        "salt_composition": "Ferrous Sulphate 100mg + Folic Acid 0.5mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of iron deficiency anemia",
        "how_to_use": "Take on empty stomach or 1 hour before food. Take once daily.",
        "common_side_effect": "Constipation, Dark stools, Nausea, Stomach pain",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "SAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Aceclofenac 100mg + Paracetamol 325mg Tablet",
        "salt_composition": "Aceclofenac 100mg + Paracetamol 325mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of pain and inflammation",
        "how_to_use": "Take after food. Take twice daily as needed.",
        "common_side_effect": "Nausea, Stomach pain, Diarrhea, Dizziness",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Metoprolol 25mg Tablet",
        "salt_composition": "Metoprolol 25mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of hypertension and heart failure",
        "how_to_use": "Take with or immediately after food. Take once or twice daily as prescribed.",
        "common_side_effect": "Fatigue, Dizziness, Slow heartbeat, Cold extremities",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "CAUTION - may cause dizziness",
        "source_file": "sample",
    },
    {
        "product_name": "Spironolactone 25mg Tablet",
        "salt_composition": "Spironolactone 25mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of edema and heart failure",
        "how_to_use": "Take with food. Take once or twice daily as prescribed.",
        "common_side_effect": "Dizziness, Nausea, Breast tenderness, Increased potassium",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Gabapentin 300mg Capsule",
        "salt_composition": "Gabapentin 300mg",
        "medicine_type": "Capsule",
        "primary_use": "Treatment of epilepsy and neuropathic pain",
        "how_to_use": "Take with food. Usually thrice daily. Do not stop abruptly.",
        "common_side_effect": "Drowsiness, Dizziness, Fatigue, Weight gain",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "UNSAFE - causes drowsiness",
        "source_file": "sample",
    },
    {
        "product_name": "Furosemide 40mg Tablet",
        "salt_composition": "Furosemide 40mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of edema and hypertension",
        "how_to_use": "Take in the morning on empty stomach. Take once daily.",
        "common_side_effect": "Dizziness, Dehydration, Low potassium, Frequent urination",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Amitriptyline 10mg Tablet",
        "salt_composition": "Amitriptyline 10mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of depression and neuropathic pain",
        "how_to_use": "Take at bedtime. May cause drowsiness.",
        "common_side_effect": "Drowsiness, Dry mouth, Weight gain, Constipation",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "UNSAFE - causes drowsiness",
        "source_file": "sample",
    },
    {
        "product_name": "Metronidazole 400mg Tablet",
        "salt_composition": "Metronidazole 400mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of bacterial and protozoal infections",
        "how_to_use": "Take after food, three times daily for 5-7 days.",
        "common_side_effect": "Nausea, Metallic taste, Headache, Dark urine",
        "alcohol_interaction": "UNSAFE - causes severe reaction",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Norfloxacin 400mg Tablet",
        "salt_composition": "Norfloxacin 400mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of urinary tract infections",
        "how_to_use": "Take on empty stomach, 1 hour before or 2 hours after food. Take twice daily for 3-5 days.",
        "common_side_effect": "Nausea, Headache, Dizziness, Rash",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Ofloxacin 200mg Tablet",
        "salt_composition": "Ofloxacin 200mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of bacterial infections",
        "how_to_use": "Take twice daily with or without food. Complete the full course.",
        "common_side_effect": "Nausea, Diarrhea, Headache, Insomnia",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Chloroquine 250mg Tablet",
        "salt_composition": "Chloroquine Phosphate 250mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of malaria",
        "how_to_use": "Take after food. Follow the exact dosing schedule given by doctor.",
        "common_side_effect": "Nausea, Headache, Diarrhea, Blurred vision",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Hydroxychloroquine 200mg Tablet",
        "salt_composition": "Hydroxychloroquine 200mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of rheumatoid arthritis and lupus",
        "how_to_use": "Take with food or milk. Take once or twice daily as prescribed.",
        "common_side_effect": "Nausea, Headache, Dizziness, Visual disturbances",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Sildenafil 50mg Tablet",
        "salt_composition": "Sildenafil 50mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of erectile dysfunction",
        "how_to_use": "Take as needed, about 1 hour before sexual activity. Do not take more than once daily.",
        "common_side_effect": "Headache, Flushing, Nasal congestion, Dizziness",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "Not applicable",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Tamsulosin 0.4mg Capsule",
        "salt_composition": "Tamsulosin 0.4mg",
        "medicine_type": "Capsule",
        "primary_use": "Treatment of benign prostatic hyperplasia",
        "how_to_use": "Take once daily, 30 minutes after the same meal each day.",
        "common_side_effect": "Dizziness, Abnormal ejaculation, Runny nose",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "Not applicable",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Finasteride 1mg Tablet",
        "salt_composition": "Finasteride 1mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of male pattern hair loss",
        "how_to_use": "Take once daily with or without food.",
        "common_side_effect": "Decreased libido, Erectile dysfunction",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "UNSAFE - women should not handle broken tablets",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Ondansetron 4mg Tablet",
        "salt_composition": "Ondansetron 4mg",
        "medicine_type": "Tablet",
        "primary_use": "Prevention of nausea and vomiting",
        "how_to_use": "Take before meals, twice or thrice daily as needed.",
        "common_side_effect": "Headache, Constipation, Fatigue",
        "alcohol_interaction": "SAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Escitalopram 10mg Tablet",
        "salt_composition": "Escitalopram 10mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of depression and anxiety",
        "how_to_use": "Take once daily at the same time. Can be taken with or without food.",
        "common_side_effect": "Nausea, Headache, Insomnia, Sexual dysfunction",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Sertraline 50mg Tablet",
        "salt_composition": "Sertraline 50mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of depression, OCD, and anxiety disorders",
        "how_to_use": "Take once daily, with or without food. Take at the same time daily.",
        "common_side_effect": "Nausea, Diarrhea, Insomnia, Dry mouth",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Enalapril 5mg Tablet",
        "salt_composition": "Enalapril 5mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of hypertension and heart failure",
        "how_to_use": "Take once daily. Can be taken with or without food.",
        "common_side_effect": "Dry cough, Dizziness, Headache, Fatigue",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Lisinopril 5mg Tablet",
        "salt_composition": "Lisinopril 5mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of hypertension",
        "how_to_use": "Take once daily at the same time.",
        "common_side_effect": "Dry cough, Dizziness, Headache",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Propranolol 40mg Tablet",
        "salt_composition": "Propranolol 40mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of hypertension, anxiety, and migraine prevention",
        "how_to_use": "Take two to three times daily with food.",
        "common_side_effect": "Fatigue, Cold hands, Dizziness, Slow heartbeat",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Phenytoin 100mg Tablet",
        "salt_composition": "Phenytoin 100mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of epilepsy and seizures",
        "how_to_use": "Take with or after food. Take two to three times daily. Do not stop abruptly.",
        "common_side_effect": "Drowsiness, Gum overgrowth, Dizziness, Nausea",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "UNSAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Carbamazepine 200mg Tablet",
        "salt_composition": "Carbamazepine 200mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of epilepsy and trigeminal neuralgia",
        "how_to_use": "Take with food, twice or three times daily. Do not stop abruptly.",
        "common_side_effect": "Drowsiness, Dizziness, Nausea, Blurred vision",
        "alcohol_interaction": "UNSAFE",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "UNSAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Digoxin 0.25mg Tablet",
        "salt_composition": "Digoxin 0.25mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of heart failure and atrial fibrillation",
        "how_to_use": "Take once daily at the same time. Can be taken with or without food.",
        "common_side_effect": "Nausea, Dizziness, Visual disturbances, Bradycardia",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "CAUTION",
        "source_file": "sample",
    },
    {
        "product_name": "Pioglitazone 15mg Tablet",
        "salt_composition": "Pioglitazone 15mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of type 2 diabetes mellitus",
        "how_to_use": "Take once daily with or without food.",
        "common_side_effect": "Weight gain, Edema, Bone fractures, Upper respiratory infection",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Sitagliptin 100mg Tablet",
        "salt_composition": "Sitagliptin 100mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of type 2 diabetes mellitus",
        "how_to_use": "Take once daily with or without food.",
        "common_side_effect": "Headache, Upper respiratory infection, Stomach pain",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "CONSULT YOUR DOCTOR",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Vildagliptin 50mg Tablet",
        "salt_composition": "Vildagliptin 50mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of type 2 diabetes mellitus",
        "how_to_use": "Take twice daily, morning and evening, with or without food.",
        "common_side_effect": "Headache, Dizziness, Tremor, Nausea",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Acarbose 50mg Tablet",
        "salt_composition": "Acarbose 50mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of type 2 diabetes mellitus",
        "how_to_use": "Take with the first bite of each main meal. Usually three times daily.",
        "common_side_effect": "Flatulence, Diarrhea, Stomach pain",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
    {
        "product_name": "Empagliflozin 10mg Tablet",
        "salt_composition": "Empagliflozin 10mg",
        "medicine_type": "Tablet",
        "primary_use": "Treatment of type 2 diabetes mellitus",
        "how_to_use": "Take once daily in the morning, with or without food.",
        "common_side_effect": "Urinary tract infection, Genital infection, Increased urination",
        "alcohol_interaction": "CAUTION",
        "pregnancy_interaction": "UNSAFE",
        "driving_interaction": "SAFE",
        "source_file": "sample",
    },
]


def seed_database():
    """Create tables and seed sample medicines"""
    print("Creating database tables...")
    Base.metadata.create_all(engine)
    print("Tables created successfully.")

    db = SessionLocal()
    try:
        # Check if sample data already exists
        existing = db.query(Medicine).filter(Medicine.source_file == "sample").count()
        if existing > 0:
            print(f"Sample data already exists ({existing} records). Deleting old sample data...")
            db.query(Medicine).filter(Medicine.source_file == "sample").delete()
            db.commit()

        # Insert sample medicines
        inserted = 0
        for med_data in SAMPLE_MEDICINES:
            medicine = Medicine(
                product_name=med_data["product_name"],
                salt_composition=med_data.get("salt_composition"),
                medicine_type=med_data.get("medicine_type"),
                primary_use=med_data.get("primary_use"),
                how_to_use=med_data.get("how_to_use"),
                common_side_effect=med_data.get("common_side_effect"),
                alcohol_interaction=med_data.get("alcohol_interaction"),
                pregnancy_interaction=med_data.get("pregnancy_interaction"),
                lactation_interaction=med_data.get("lactation_interaction"),
                driving_interaction=med_data.get("driving_interaction"),
                kidney_interaction=med_data.get("kidney_interaction"),
                liver_interaction=med_data.get("liver_interaction"),
                source_file=med_data["source_file"],
                created_at=datetime.utcnow(),
                updated_at=datetime.utcnow(),
            )
            db.add(medicine)
            inserted += 1

        db.commit()
        print(f"Successfully inserted {inserted} sample medicines.")

        # Verify
        total = db.query(Medicine).count()
        sample_count = db.query(Medicine).filter(Medicine.source_file == "sample").count()
        print(f"Total medicines in DB: {total}")
        print(f"Sample medicines: {sample_count}")

    except Exception as e:
        db.rollback()
        print(f"Error seeding data: {e}")
        raise
    finally:
        db.close()


if __name__ == "__main__":
    seed_database()
