65 lines
3.0 KiB
Dart
65 lines
3.0 KiB
Dart
import 'dart:math';
|
|
|
|
class DataGenerator {
|
|
static final Random _random = Random();
|
|
|
|
static final List<String> _firstNames = [
|
|
'Alice', 'Bob', 'Charlie', 'David', 'Eva', 'Félix', 'Gabrielle', 'Hugo', 'Inès', 'Jules',
|
|
'Léa', 'Manon', 'Nathan', 'Oscar', 'Pauline', 'Quentin', 'Raphaël', 'Sophie', 'Théo', 'Victoire'
|
|
];
|
|
|
|
static final List<String> _lastNames = [
|
|
'Martin', 'Bernard', 'Dubois', 'Thomas', 'Robert', 'Richard', 'Petit', 'Durand', 'Leroy', 'Moreau',
|
|
'Simon', 'Laurent', 'Lefebvre', 'Michel', 'Garcia', 'David', 'Bertrand', 'Roux', 'Vincent', 'Fournier'
|
|
];
|
|
|
|
static final List<String> _addressSuffixes = [
|
|
'Rue de la Paix', 'Boulevard des Rêves', 'Avenue du Soleil', 'Place des Étoiles', 'Chemin des Champs'
|
|
];
|
|
|
|
static final List<String> _motivationSnippets = [
|
|
'Nous cherchons une personne de confiance.',
|
|
'Nos horaires sont atypiques.',
|
|
'Notre enfant est plein de vie.',
|
|
'Nous souhaitons une garde à temps plein.',
|
|
'Une adaptation en douceur est primordiale pour nous.',
|
|
'Nous avons hâte de vous rencontrer.',
|
|
'La pédagogie Montessori nous intéresse.'
|
|
];
|
|
|
|
static String firstName() => _firstNames[_random.nextInt(_firstNames.length)];
|
|
static String lastName() => _lastNames[_random.nextInt(_lastNames.length)];
|
|
static String address() => "${_random.nextInt(100) + 1} ${_addressSuffixes[_random.nextInt(_addressSuffixes.length)]}";
|
|
static String postalCode() => "750${_random.nextInt(10)}${_random.nextInt(10)}";
|
|
static String city() => "Paris";
|
|
static String phone() => "06${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}";
|
|
static String email(String firstName, String lastName) => "${firstName.toLowerCase()}.${lastName.toLowerCase()}@example.com";
|
|
static String password() => "password123"; // Simple pour le test
|
|
|
|
static String dob({bool isUnborn = false}) {
|
|
final now = DateTime.now();
|
|
if (isUnborn) {
|
|
final provisionalDate = now.add(Duration(days: _random.nextInt(180) + 30)); // Entre 1 et 7 mois dans le futur
|
|
return "${provisionalDate.day.toString().padLeft(2, '0')}/${provisionalDate.month.toString().padLeft(2, '0')}/${provisionalDate.year}";
|
|
} else {
|
|
final birthYear = now.year - _random.nextInt(3); // Enfants de 0 à 2 ans
|
|
final birthMonth = _random.nextInt(12) + 1;
|
|
final birthDay = _random.nextInt(28) + 1; // Simple, évite les pbs de jours/mois
|
|
return "${birthDay.toString().padLeft(2, '0')}/${birthMonth.toString().padLeft(2, '0')}/${birthYear}";
|
|
}
|
|
}
|
|
|
|
static bool boolean() => _random.nextBool();
|
|
|
|
static String motivation() {
|
|
int count = _random.nextInt(3) + 2; // 2 à 4 phrases
|
|
List<String> chosenSnippets = [];
|
|
while(chosenSnippets.length < count) {
|
|
String snippet = _motivationSnippets[_random.nextInt(_motivationSnippets.length)];
|
|
if (!chosenSnippets.contains(snippet)) {
|
|
chosenSnippets.add(snippet);
|
|
}
|
|
}
|
|
return chosenSnippets.join(' ');
|
|
}
|
|
} |