//Imports here
import { ITestData } from 'framework/TestData'
import { ServiceLocation, DamageType, Flow } from 'safelite-playwright-core';
import { PaymentMethod } from "framework/localTypes/Enums";
import { ITestCase } from '../framework/Typedefs'
import { VehicleLookupType } from 'safelite-playwright-core';
import { getDefaultTestData, setFakerSeedFromTestName } from 'safelite-playwright-core';

// Set the seed based on test name for consistent but unique data
setFakerSeedFromTestName("InsuranceGeico");

// Now get the test data with the seeded faker
const insuranceGeicoData: Partial<ITestData> = {
    ...getDefaultTestData(),  // Get default data with current seed
   
    // Key feature: Insurance flow with GEICO
    paymentMethod: PaymentMethod.Insurance,
   
    // Insurance claim flags
    isDuplicateClaim: true,
    flow: Flow.Managed,
    isUseVehicleOnPolicy: true,
   
    // Override customer details with specific name and California location
    customerDetails: {
        ...getDefaultTestData().customerDetails!,
        firstName: 'Albina',
        lastName: 'Klint',
        address: {
            ...getDefaultTestData().customerDetails!.address,
            city: 'Ontario',
            state: 'California',
            postalCode: '91761'
        }
    },
   
    // Insurance claim details
    claimDetails: {
        client: 'GEICO',
        policyNumber: 'Mock250034C',
        policyDeductible: 0,
        damageDate: new Date(new Date().setDate(new Date().getDate() - 1)).toLocaleDateString('en-US', {month: '2-digit', day: '2-digit', year: 'numeric'}),
        damageCause: DamageType.Hail
    },
   
    // Hyundai vehicle details with VIN lookup
    vehicleDetails: {
        ...getDefaultTestData().vehicleDetails!,
        year: '2018',
        make: 'Hyundai',
        model: 'Elantra',
        style: '4 door sedan',
        vin: '5NPD84LFXJH285828',
        vehicleLookupType: VehicleLookupType.Vin,
    },
   
    // No need to override vehicleDamage as it already defaults to WindshieldCrack
   
    // Override for in-shop appointment
    appointmentDetails: {
        serviceLocation: ServiceLocation.InShop,
        shopAddress: '8985 Yellow Brick Rd, Rosedale, MD 21237',
        appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate
    },
       
    // Override payment details (empty because we skip payment method page in insurance flow)
    paymentDetails: {}
}

const insuranceGeicoTests: ITestCase[] = [];

const tc = {
    name: `InsuranceGeico`,
    tags: ['@E2E','@InsuranceGeico', '@test_report', '@Insurance'],
    testData: insuranceGeicoData
};
insuranceGeicoTests.push(tc);

export default insuranceGeicoTests;