File size: 14,546 Bytes
41bd0b8
 
 
 
a5778f2
41bd0b8
a5778f2
 
41bd0b8
a5778f2
41bd0b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a5778f2
41bd0b8
 
a5778f2
41bd0b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a5778f2
41bd0b8
a5778f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
"""
Initialize Too Many Cables database with sample data
"""

from .database import DatabaseManager
import os

def init_sample_data():
    """Initialize database with sample data for testing"""
    db = DatabaseManager()
    
    print("Adding sample products...")
    
    # Sample products for Too Many Cables
    products = [
        {
            'sku': 'TMC-WM001',
            'name': 'UltraGrip Wireless Mouse',
            'description': 'Ergonomic wireless mouse with precision tracking and 18-month battery life',
            'category': 'Mice',
            'price': 49.99,
            'features': 'Wireless, Ergonomic, Long Battery Life, Precision Tracking',
            'specifications': '2.4GHz wireless, 1600 DPI, 18-month battery, USB receiver',
            'warranty_months': 24
        },
        {
            'sku': 'TMC-KB002',
            'name': 'StreamType Wireless Keyboard',
            'description': 'Full-size wireless keyboard with quiet keys and backlighting',
            'category': 'Keyboards',
            'price': 79.99,
            'features': 'Wireless, Backlit, Quiet Keys, Full Size',
            'specifications': '2.4GHz wireless, Backlit keys, Low-profile switches, USB-C charging',
            'warranty_months': 24
        },
        {
            'sku': 'TMC-HP003',
            'name': 'SoundFree Wireless Headphones',
            'description': 'Premium wireless headphones with active noise cancellation',
            'category': 'Headphones',
            'price': 199.99,
            'features': 'Wireless, Noise Cancelling, Premium Audio, Long Battery',
            'specifications': 'Bluetooth 5.0, 30-hour battery, Active noise cancelling, Comfortable ear cups',
            'warranty_months': 12
        },
        {
            'sku': 'TMC-WC004',
            'name': 'PowerFlow Wireless Charger',
            'description': 'Fast wireless charging pad for smartphones and devices',
            'category': 'Chargers',
            'price': 39.99,
            'features': 'Fast Charging, Universal Compatibility, LED Indicator',
            'specifications': '15W fast charging, Qi compatible, LED status indicator',
            'warranty_months': 12
        },
        {
            'sku': 'TMC-SP005',
            'name': 'BoomBox Wireless Speaker',
            'description': 'Portable Bluetooth speaker with 360-degree sound',
            'category': 'Speakers',
            'price': 89.99,
            'features': 'Portable, 360-degree Sound, Waterproof, Long Battery',
            'specifications': 'Bluetooth 5.0, 20-hour battery, IPX7 waterproof, 360-degree audio',
            'warranty_months': 18
        }
    ]
    
    with db.get_connection() as conn:
        cursor = conn.cursor()
        for product in products:
            cursor.execute('''
                INSERT OR REPLACE INTO products 
                (sku, name, description, category, price, features, specifications, warranty_months)
                VALUES (?, ?, ?, ?, ?, ?, ?, ?)
            ''', (product['sku'], product['name'], product['description'], product['category'],
                  product['price'], product['features'], product['specifications'], product['warranty_months']))
        conn.commit()
    
    print("Adding sample knowledge base articles...")
    
    # Sample knowledge base articles
    kb_articles = [
        {
            'title': 'How to Connect Your Wireless Mouse',
            'content': '''
To connect your Too Many Cables wireless mouse:

1. Insert the batteries into your mouse (2 AA batteries)
2. Plug the USB receiver into an available USB port on your computer
3. Turn on the mouse using the power switch on the bottom
4. Wait 2-3 seconds for automatic pairing
5. Test the mouse movement and clicks

If the mouse doesn't connect immediately:
- Try moving the USB receiver to a different port
- Make sure the mouse is within 10 feet of the receiver
- Check that the batteries are properly installed
- Press the connect button on both the mouse and receiver

The mouse will automatically enter sleep mode after 10 minutes of inactivity to preserve battery life.
            ''',
            'category': 'Setup Guides',
            'subcategory': 'Mice',
            'tags': 'wireless, mouse, connection, setup, pairing',
            'document_type': 'manual',
            'author': 'TMC Support Team'
        },
        {
            'title': 'Keyboard Not Responding - Troubleshooting',
            'content': '''
If your wireless keyboard is not responding:

**Check the Basics:**
1. Ensure the keyboard is turned on (check power switch)
2. Verify the USB receiver is properly connected
3. Check battery level (low battery indicator will show)
4. Make sure you're within range (30 feet maximum)

**Try These Solutions:**
1. Re-sync the keyboard:
   - Press and hold the Connect button on the receiver for 3 seconds
   - Press the Connect button on the back of the keyboard
   - Wait for the LED to stop blinking

2. Replace batteries:
   - Use fresh AA batteries
   - Ensure proper polarity (+/- orientation)

3. Test on another computer:
   - This helps determine if it's a hardware issue

4. Clean the keyboard:
   - Use compressed air to remove debris
   - Wipe with slightly damp cloth

If problems persist, contact our support team with your product serial number.
            ''',
            'category': 'Troubleshooting',
            'subcategory': 'Keyboards',
            'tags': 'keyboard, troubleshooting, not responding, wireless, connection',
            'document_type': 'article',
            'author': 'TMC Support Team'
        },
        {
            'title': 'Wireless Headphone Audio Quality Issues',
            'content': '''
To improve audio quality on your wireless headphones:

**Common Audio Issues:**

1. **Crackling or Static:**
   - Move closer to your device (reduce interference)
   - Check for other wireless devices causing interference
   - Ensure headphones are fully charged
   - Try different audio source

2. **Low Volume:**
   - Check volume on both device and headphones
   - Ensure headphones are not in power-saving mode
   - Clean headphone drivers with soft cloth

3. **Audio Cutting Out:**
   - Stay within 30-foot range of connected device
   - Remove obstacles between headphones and device
   - Reset Bluetooth connection
   - Update device drivers

**Reset Instructions:**
1. Turn off headphones
2. Hold power button for 10 seconds until LED flashes red/blue alternately
3. Re-pair with your device

**Optimal Settings:**
- Use high-quality audio codecs (aptX, AAC)
- Keep devices updated
- Avoid interference from WiFi routers, microwaves
            ''',
            'category': 'Troubleshooting',
            'subcategory': 'Headphones',
            'tags': 'headphones, audio quality, bluetooth, crackling, volume, wireless',
            'document_type': 'article',
            'author': 'TMC Support Team'
        },
        {
            'title': 'Warranty and Return Policy',
            'content': '''
**Too Many Cables Warranty Policy**

**Standard Warranty Coverage:**
- Mice and Keyboards: 24 months
- Headphones and Speakers: 12-18 months (varies by model)
- Chargers and Accessories: 12 months

**What's Covered:**
- Manufacturing defects
- Hardware failures under normal use
- Battery-related issues (first 6 months)

**What's NOT Covered:**
- Physical damage from drops or spills
- Battery degradation after 6 months
- Damage from misuse or modifications
- Normal wear and tear

**How to Make a Warranty Claim:**
1. Contact our support team with:
   - Product serial number
   - Purchase date and receipt
   - Description of the issue
2. We'll provide troubleshooting steps
3. If unresolved, we'll issue an RMA number
4. Ship the product back using provided prepaid label
5. Receive replacement within 5-7 business days

**Return Policy:**
- 30-day return window from purchase date
- Products must be in original condition
- Original packaging required
- Restocking fee may apply for opened software items

For warranty claims, email support@toomanycables.com or call 1-800-TMC-HELP
            ''',
            'category': 'Policies',
            'subcategory': 'Warranty',
            'tags': 'warranty, return, policy, RMA, coverage, claim',
            'document_type': 'policy',
            'author': 'TMC Legal Team'
        },
        {
            'title': 'Battery Life and Charging Best Practices',
            'content': '''
**Maximizing Battery Life for Your Wireless Devices**

**General Tips:**
1. **First Use:** Fully charge new devices before first use
2. **Storage:** Store devices at 50% charge if not using for extended periods
3. **Temperature:** Avoid extreme hot or cold temperatures
4. **Regular Use:** Use devices regularly to maintain battery health

**Device-Specific Guidelines:**

**Mice:**
- Expected life: 12-18 months with AA batteries
- Use high-quality alkaline or lithium batteries
- Turn off when not in use for extended periods
- Replace both batteries at the same time

**Keyboards:**
- Expected life: 6-12 months with AA batteries
- Turn off backlighting when not needed
- Use auto-sleep feature
- Consider rechargeable batteries for heavy use

**Headphones:**
- Charge cycles: 500+ full charges expected
- Don't leave plugged in after reaching 100%
- Use original charging cable
- Charge before battery completely drains

**Speakers:**
- Expected life: 15-20 hours per charge
- Avoid overcharging (unplug when full)
- Use moderate volume levels to extend battery life
- Store at room temperature

**Warning Signs of Battery Issues:**
- Significantly reduced operating time
- Device randomly shutting off
- Charging indicator not working properly
- Swollen battery (discontinue use immediately)

Contact support if you experience battery issues within the warranty period.
            ''',
            'category': 'Maintenance',
            'subcategory': 'Battery Care',
            'tags': 'battery, charging, life, maintenance, care, wireless',
            'document_type': 'article',
            'author': 'TMC Support Team'
        }
    ]
    
    for article in kb_articles:
        db.add_knowledge_base_document(
            title=article['title'],
            content=article['content'],
            category=article['category'],
            subcategory=article['subcategory'],
            tags=article['tags'],
            document_type=article['document_type'],
            author=article['author']
        )
    
    print("Adding sample FAQ entries...")
    
    # Sample FAQ entries
    faqs = [
        {
            'title': 'How long do wireless device batteries last?',
            'content': 'Battery life varies by device: Mice (12-18 months), Keyboards (6-12 months), Headphones (20+ hours per charge), Speakers (15-20 hours per charge). Actual life depends on usage patterns and settings.',
            'category': 'FAQ',
            'subcategory': 'Battery',
            'tags': 'battery, life, duration, FAQ',
            'document_type': 'faq'
        },
        {
            'title': 'What if my wireless device won\'t connect?',
            'content': 'First, ensure the device is on and within range (30 feet). Check that the USB receiver is properly connected. Try re-syncing by pressing the connect buttons on both devices. If issues persist, try fresh batteries or contact support.',
            'category': 'FAQ',
            'subcategory': 'Connection',
            'tags': 'connection, pairing, wireless, troubleshooting, FAQ',
            'document_type': 'faq'
        },
        {
            'title': 'Do you offer international shipping?',
            'content': 'Yes, we ship to most countries worldwide. International shipping typically takes 7-14 business days. Additional customs fees may apply depending on your location. Free shipping is available for orders over $75 within the US.',
            'category': 'FAQ',
            'subcategory': 'Shipping',
            'tags': 'shipping, international, delivery, FAQ',
            'document_type': 'faq'
        },
        {
            'title': 'How do I update firmware on my devices?',
            'content': 'Most Too Many Cables devices don\'t require firmware updates. However, if updates are available, we\'ll notify customers via email and provide download links and instructions on our support website.',
            'category': 'FAQ',
            'subcategory': 'Updates',
            'tags': 'firmware, updates, software, FAQ',
            'document_type': 'faq'
        }
    ]
    
    for faq in faqs:
        db.add_knowledge_base_document(
            title=faq['title'],
            content=faq['content'],
            category=faq['category'],
            subcategory=faq['subcategory'],
            tags=faq['tags'],
            document_type=faq['document_type'],
            author='TMC Support Team'
        )
    
    print("Creating sample admin user...")
    
    # Create a sample admin user for testing
    admin_user_id = db.create_user(
        email='admin@toomanycables.com',
        first_name='Admin',
        last_name='User',
        password='admin123',  # Change this in production!
        company='Too Many Cables'
    )
    
    if admin_user_id:
        print(f"Created admin user with ID: {admin_user_id}")
        # Set admin role for the new user
        with db.get_connection() as conn:
            cursor = conn.cursor()
            cursor.execute('UPDATE users SET role = "admin" WHERE id = ?', (admin_user_id,))
            conn.commit()
            print("Set admin role for admin user")
    else:
        print("Admin user already exists")
    
    # Create a sample customer user
    customer_user_id = db.create_user(
        email='customer@example.com',
        first_name='John',
        last_name='Customer',
        password='customer123',
        phone='555-0123',
        company='Example Corp'
    )
    
    if customer_user_id:
        print(f"Created customer user with ID: {customer_user_id}")
    else:
        print("Customer user already exists")
    
    print("\nDatabase initialization complete!")
    print("\nSample users created:")
    print("- Admin: admin@toomanycables.com / admin123")
    print("- Customer: customer@example.com / customer123")
    print("\nDatabase contains:")
    print("- 5 sample products")
    print("- 9 knowledge base articles/FAQs")
    print("- Complete schema for users, sessions, conversations, tickets, and more")

if __name__ == "__main__":
    init_sample_data()