import ClientData from "@business-logic/data/ClientData";
import { DamageType, 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 essentialReplaceStaticAdasData: Partial<ITestData> = {
    clientTag: 'ALL_ESSENTIAL',
    isDuplicateClaim: false,
    isPolicyFound: false,
    endorsements: [],
    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(),
            city: 'Knoxville',
            state: 'Tennessee',
            postalCode: '37996',
            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: '2019',
        make: 'Toyota',
        model: 'C-HR',
        style: '4 door hatchback',
        vin: 'NMTKHMBX5KR086519',
        vehicleLookupType: VehicleLookupType.Vin,

    },
    vehicleDamage: [
        VehicleDamage.WindshieldCrack,
    ],
    appointmentDetails: {
        serviceLocation: ServiceLocation.DropOff,
        appointmentDate: nextWeekday
    }

}

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

export default essentialReplaceStaticAdasTests;