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

const nextWeekday = getNextWeekday();

const essentialTpaNotEnabledData: Partial<ITestData> = {
    clientTag: 'ALL_ESSENTIAL',
    isDuplicateClaim: false,
    isPolicyFound: false,
    endorsements: [],
    isReplace: true,
    partQuestions: undefined,
    isSafelite: false,
    bailoutFlags: {
        isTpaNotEnabledBailout: true
    },
    servicePackage: faker.helpers.enumValue(ServicePackage),
    customerDetails: {
        firstName: faker.person.firstName(),
        lastName: faker.person.lastName(),
        email: "itqatest@safelite.com",
        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: '7913 Station Street',
            city: 'Dublin',
            state: 'Ohio',
            postalCode: '43016',
            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: '2015',
        make: 'Ford',
        model: 'F Series F150',
        style: '2 door super cab',
        vin: '1FTEX1C82FFB42543',
        licensePlateNumber: '15377DV',
        licensePlateState: 'Texas',
        vehicleLookupType: VehicleLookupType.LicensePlateNumber,
    },
    vehicleDamage: [
        // VehicleDamage.WindshieldThreeChips,
        VehicleDamage.WindshieldCrack,
        // VehicleDamage.DriverFrontDoor,
        // VehicleDamage.DriverQuarterPanel,
        // VehicleDamage.DriverRearDoor,
        // VehicleDamage.PassengerFrontDoor,
        // VehicleDamage.PassengerQuarterPanel,
        // VehicleDamage.PassengerRearDoor,
        // VehicleDamage.RearWindow
    ],
    appointmentDetails: {
        serviceLocation: ServiceLocation.InShop,
        shopAddress: '6826 Sawmill Rd, Columbus, OH 43235',
        appointmentDate: nextWeekday
    }

}

const essentialClients = ClientData.getEssentialClientsWithTpaDisabled();
const essentialTpaNotEnabledReplace_0017: TestCase[] = [];
for (const client of essentialClients) {
    const data = {...essentialTpaNotEnabledData};
    data.clientTag = client.clientTag;
    data.isAuthenticationRequired = client.clientFlags.isAuthenticationEnabled ?? false
    const tc = new TestCase({
        name: `0017 Essential TPA Not Enabled Bailout Client: "${client.accountName}"`,
        tags: [`@${client.clientTag}`, `@${client.accountName}`, '@Bailout', '@TpaNotEnabled', '@Essentials','@0017'],
        testData: data
    }, undefined, '0017');
    essentialTpaNotEnabledReplace_0017.push(tc);
}

export default essentialTpaNotEnabledReplace_0017;