import ClientData from "@business-logic/data/ClientData";
import { DamageType, PartQuestionType, ServiceLocation, ServicePackage, VehicleDamage, VehicleLookupType } from "@business-logic/types/Enums";
import { ITestData } from "@business-logic/types/ITestData"
import TestCase from "@business-logic/types/TestCase";
import { faker } from "@faker-js/faker";
import { getNextWeekday } from "@impl/utils/DateUtils";

const nextWeekday = getNextWeekday();

const essentialReplaceData: Partial<ITestData> = {
    clientTag: 'ALL_ESSENTIAL',
    isDuplicateClaim: false,
    isPolicyFound: false,
    endorsements: [],
    isReplace: false,
    vehiclePartQuestions: [
        {
            partQuestionType: PartQuestionType.WindshieldColor,
            isOnPage: true,
            optionToSelect: 'Green Tint, Blue Shade'
        },
        // {
        //     partQuestionType: PartQuestionType.DriverFrontColor,
        //     isOnPage: true,
        //     optionToSelect: 'Green Tint'
        // },
    ],

    isSafelite: true,
    servicePackage: faker.helpers.enumValue(ServicePackage),
    customerDetails: {
        firstName: faker.person.firstName(),
        lastName: faker.person.lastName(),
        email: faker.internet.email(),
        phoneNumber: faker.helpers.fromRegExp(/[2-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]/),
        notes: 'Automated Test',
        address: {
            // street: faker.location.streetAddress(),
            street: '456 Columbus Pike',
            city: 'Dublin',
            state: 'Ohio',
            postalCode: '43223',
            country: 'United States'
        }
    },
    claimDetails: {
        policyNumber: faker.string.alphanumeric(5),
        policyDeductible: -1,   // Not advanced, so we don't care about deductible.
        damageDate: '2024-10-10',
        damageCause: DamageType.Other
    },
    vehicleDetails: {
        year: '2011',
        make: 'Nissan',
        model: 'XTerra',
        style: '4 door utility',
        vin: '5N1AN0NW9BC524974',
        vehicleLookupType: VehicleLookupType.Vin,
    },
    vehicleDamage: [
        VehicleDamage.WindshieldCrack,
        // VehicleDamage.DriverFrontDoor,
    ],
    appointmentDetails: {
        serviceLocation: ServiceLocation.DropOff,
        shopAddress: undefined,
        appointmentDate: nextWeekday
    }
}

const essentialClients = ClientData.getEssentialClients();
const essentialReplacePartsQuestionsDropoff_0015: TestCase[] = [];
for (const client of essentialClients) {
    const data = { ...essentialReplaceData };
    data.clientTag = client.clientTag;
    data.isAuthenticationRequired = client.clientFlags.isAuthenticationEnabled ?? false
    const tc = new TestCase({
        name: `0015 Essential Replace Client: "${client.accountName}"`,
        tags: [`@${client.clientTag}`, `@${client.accountName}`, '@Essentials','@0015'],
        testData: data
    }, undefined, '0015');
    essentialReplacePartsQuestionsDropoff_0015.push(tc);
}

export default essentialReplacePartsQuestionsDropoff_0015;