//Imports here
import { ITestData } from 'framework/TestData'
import { ServiceLocation, PartQuestionType, PaymentType } 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("CashReplaceSafeliteCanNotRecalMobile");

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

    // CASH Client
    paymentMethod: PaymentMethod.SelfPay,
   
    // Special flag to skip estimate page
    isSkipEstimatePage: true,

    // Special flag to verify safelite can not recalibrate in the backend
    isCanNotRecal: true,
   
    // Override customer postal code
    customerDetails: {
        ...getDefaultTestData().customerDetails!,
        address: {
            ...getDefaultTestData().customerDetails!.address,
            postalCode: '21237'
        }
    },
   
    // Override vehicle details - vehicle with recalibration that Safelite cannot perform
    vehicleDetails: {
        ...getDefaultTestData().vehicleDetails!,
        year: '2009',
        make: 'Volkswagen',
        model: 'Passat CC',
        style: '4 door sedan',
        vin: 'VWML73C79E552439',
        vehicleLookupType: VehicleLookupType.Zip
    },
   
    // No need to override vehicleDamage as it already defaults to WindshieldCrack
   
    // Override for mobile service
    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'
        },
    },
   
    // Payment at service
    paymentDetails: {
        paymentType: PaymentType.PayAtService
    },
   
    // Part questions related to recalibration
    partQuestions: [
        {
            partQuestionType: PartQuestionType.GeneralQuestion1,
            isOnPage: true,
            optionToSelect: 'Yes'
        },
    ]
}

const cashReplaceSafeliteCanNotRecalMobileTests: ITestCase[] = [];

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

export default cashReplaceSafeliteCanNotRecalMobileTests;