/**
 * Basic Usage Examples
 * 基本使用示例
 */

const CardGenerator = require('../src/tools/card-generator/generator');
const Formatter = require('../src/tools/card-generator/formatter');

const generator = new CardGenerator();
const formatter = new Formatter();

console.log('=== 信用卡生成器使用示例 ===\n');

// 示例1: 生成单张银联卡
console.log('1. 生成单张银联卡:');
const unionpayCard = generator.generate('unionpay');
console.log(formatter.format(unionpayCard, 'pipe'));
console.log('');

// 示例2: 生成Visa卡（JSON格式）
console.log('2. 生成Visa卡 (JSON格式):');
const visaCard = generator.generate('visa');
console.log(formatter.format(visaCard, 'json'));
console.log('');

// 示例3: 批量生成
console.log('3. 批量生成5张银联卡:');
const cards = generator.generateBatch(5, 'unionpay');
cards.forEach((card, index) => {
  console.log(`${index + 1}. ${formatter.format(card, 'pipe')}`);
});
console.log('');

// 示例4: 不同格式输出
console.log('4. 不同格式输出同一张卡:');
const testCard = generator.generate('mastercard');
console.log('Pipe格式:', formatter.format(testCard, 'pipe'));
console.log('CSV格式:', formatter.format(testCard, 'csv'));
console.log('Pretty格式:\n' + formatter.format(testCard, 'pretty'));
console.log('');

// 示例5: 查看支持的类型
console.log('5. 支持的卡类型:');
const types = generator.getSupportedTypes();
types.forEach(type => {
  console.log(`  - ${type.id}: ${type.name}`);
});
