// engine/execution-plan/mobile-dist/flutter-steps.ts — SPEC-013
// Distribution steps for Flutter release specs.
function buildFlutterBuildStep(order) {
    return {
        order,
        title: 'Flutter release build (iOS + Android)',
        description: 'Build signed artifacts for both platforms:\n' +
            '- iOS: `flutter build ipa --release` → build/ios/ipa/\n' +
            '- Android: `flutter build appbundle --release` → build/app/outputs/bundle/release/\n' +
            'Verify `flutter analyze` shows no errors.',
        files: ['pubspec.yaml', 'ios/Podfile', 'android/app/build.gradle'],
        dependsOn: [],
        verification: 'IPA and AAB artifacts exist. `flutter build` exits 0. `codesign -dv` and `jarsigner -verify` both pass.',
        estimatedMinutes: 25,
        canRollback: false,
    };
}
function buildFlutterIOSUploadStep(order) {
    return {
        order,
        title: 'Upload iOS to TestFlight',
        description: 'Upload IPA to App Store Connect via Fastlane or Transporter:\n' +
            '`fastlane pilot upload --ipa build/ios/ipa/Runner.ipa`\n' +
            'Assign internal testers for smoke testing.',
        files: ['Fastfile'],
        dependsOn: [],
        verification: 'Build appears in TestFlight. Internal testers receive invitation.',
        estimatedMinutes: 15,
        canRollback: false,
    };
}
function buildFlutterAndroidUploadStep(order) {
    return {
        order,
        title: 'Upload Android AAB to Google Play (internal track)',
        description: 'Upload AAB to Play Console internal testing track:\n' +
            '`fastlane supply --aab build/app/outputs/bundle/release/app-release.aab --track internal`\n' +
            'Invite testers via email or Google Groups.',
        files: ['Fastfile'],
        dependsOn: [],
        verification: 'AAB visible in Play Console internal track. Testers can install via opt-in link.',
        estimatedMinutes: 15,
        canRollback: false,
    };
}
function buildFlutterSmokeTestStep(order) {
    return {
        order,
        title: 'Smoke test on real devices',
        description: 'Test critical flows on physical devices:\n' +
            '- iOS: install from TestFlight on iPhone/iPad\n' +
            '- Android: install from Play Console on Android device\n' +
            'Verify: app launch, auth, primary feature, crash-free session.',
        files: [],
        dependsOn: [],
        verification: 'App launches on both platforms without crash. Core flows complete. No platform-specific regressions.',
        estimatedMinutes: 45,
        canRollback: false,
    };
}
function buildFlutterStoreSubmitStep(order) {
    return {
        order,
        title: 'Submit to App Store & Google Play (production)',
        description: 'Submit for production review:\n' +
            '- iOS: `fastlane deliver` → App Store Connect review (1-3 business days)\n' +
            '- Android: promote internal → production via `fastlane supply --track internal --track_promote_to production`\n' +
            'Complete metadata: screenshots, privacy manifest, content rating.',
        files: ['fastlane/metadata/', 'PrivacyInfo.xcprivacy', 'fastlane/metadata/android/'],
        dependsOn: [],
        verification: 'App Store Connect shows "In Review". Play Console shows production rollout pending or live.',
        estimatedMinutes: 30,
        canRollback: false,
    };
}
function buildFlutterPhasedRolloutStep(order) {
    return {
        order,
        title: 'Phased rollout (both stores)',
        description: 'Enable phased rollout:\n' +
            '- iOS: App Store Connect → Pricing & Availability → Phased Release (7-day automatic)\n' +
            '- Android: Play Console → set rollout percentage (1% → 100% over 7 days)\n' +
            'Monitor: crash-free rate > 99.5%, Flutter frame rate stable.',
        files: [],
        dependsOn: [],
        verification: 'Phased release active. Crash-free sessions stable. ANR rate within Play Store limits.',
        estimatedMinutes: 15,
        canRollback: true,
    };
}
function buildFlutterMonitorStep(order) {
    return {
        order,
        title: 'Post-release monitoring',
        description: 'Monitor for 24h post-release:\n' +
            '- Crashlytics: crash-free sessions > 99.5%\n' +
            '- Android Vitals: ANR < 0.47%, crash rate < 1.09%\n' +
            '- Firebase Performance: app start time, frame rendering\n' +
            'Rollback: halt phased release in both stores if thresholds exceeded.',
        files: [],
        dependsOn: [],
        verification: 'No P0 crashes. Performance metrics within expected range. Rollback plan documented.',
        estimatedMinutes: 60,
        canRollback: true,
    };
}
export function generateFlutterDistributionPhase(startOrder) {
    let order = startOrder;
    return [
        buildFlutterBuildStep(order++),
        buildFlutterIOSUploadStep(order++),
        buildFlutterAndroidUploadStep(order++),
        buildFlutterSmokeTestStep(order++),
        buildFlutterStoreSubmitStep(order++),
        buildFlutterPhasedRolloutStep(order++),
        buildFlutterMonitorStep(order),
    ];
}
//# sourceMappingURL=flutter-steps.js.map