//Imports here
import { ITestData } from 'framework/TestData'
import { VehicleDamage, PartQuestionType, PaymentType, ServicePackage, ServiceLocation } from 'safelite-playwright-core';
import { ITestCase } from '../framework/Typedefs'
import { VehicleLookupType } from 'safelite-playwright-core';
import { getDefaultTestData, setFakerSeedFromTestName } from 'safelite-playwright-core';
import { PaymentMethod } from 'framework/localTypes/Enums';

// Set the seed before generating any data
setFakerSeedFromTestName("CashReplaceMultiGlassMobile");

// Now get the test data with the seeded faker
const cashReplaceMultiGlassMobileData: Partial<ITestData> = {
    ...getDefaultTestData(),  // Get default data with current seed

    // CASH Client
    paymentMethod: PaymentMethod.SelfPay,

    customerDetails: {
        ...getDefaultTestData().customerDetails!,
        address: {
            ...getDefaultTestData().customerDetails!.address,
            postalCode: '21237'
        }// Override customer postal code
    
    },
   
    // Flag for recalibration vehicle
    isRecalVehicle: true,

    // Key feature: Premium Package
    servicePackage: ServicePackage.Premium,
   
    // Override appointment details
    appointmentDetails: {
        serviceLocation: ServiceLocation.Mobile,
        appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate,
        serviceAddress: {
            // Use street address from current faker seed
            street: "5050 Silver Oak Dr",
            city: 'Rosedale',
            state: 'MD',
            postalCode: '21237',
            country: 'United States'
        },
    },
   
    // Override vehicle details with VIN lookup
    vehicleDetails: {
        ...getDefaultTestData().vehicleDetails!,
        year: '2014',
        make: 'Jeep',
        model: 'Cherokee',
        style: '4 door utility',
        vin: '1C4PJLCS6EW288461',
        vehicleLookupType: VehicleLookupType.Vin
    },
   
    // Key feature: multiple damaged glasses
    vehicleDamage: [
        VehicleDamage.WindshieldCrack,
        VehicleDamage.DriverQuarterPanel,
        VehicleDamage.PassengerQuarterPanel,
    ],
   
    // Override payment details
    paymentDetails: {
        paymentType: PaymentType.PayAtService
    },
   
    // Vehicle part questions for multiple glass parts
    vehiclePartQuestions: [
        {
            partQuestionType: PartQuestionType.WindshieldColor,
            isOnPage: true,
            optionToSelect: 'Green Tint',
            secondaryQuestionOptionToSelect: 'solar'
        },
        {
            partQuestionType: PartQuestionType.DriverQuarterColor,
            isOnPage: true,
            optionToSelect: 'Green Tint',
            secondaryQuestionOptionToSelect: 'solar, driver side, encap, chrome molding'
        },
        {
            partQuestionType: PartQuestionType.PassengerQuarterColor,
            isOnPage: true,
            optionToSelect: 'Gray Tint Privacy',
            secondaryQuestionOptionToSelect: 'solar, passenger side, encap, chrome molding'
        }
    ]
}

const cashReplaceMultiGlassMobileTests: ITestCase[] = [];

const tc = {
    name: `CashReplaceMultiGlassMobile`,
    tags: ['@E2E','@CashReplaceMultiGlassMobile', '@test_report', '@CASH', '@CASH-1182'],
    testData: cashReplaceMultiGlassMobileData
};
cashReplaceMultiGlassMobileTests.push(tc);

export default cashReplaceMultiGlassMobileTests;