import endorsementOptions from '@/constants/endorsement-options';

export function noCoverageForSelectedVehicle(vehicle) {
    return (vehicle?.coverages?.length ?? 0) === 0;
}
export function deductibleForSelectedVehicle(vehicle) {
    if (!vehicle) {
        return undefined;
    }

    return vehicle.coverages?.length ?? false
        ? vehicle?.coverages[0].deductible
        : 0;
}
export function endorsementsForSelectedVehicle(vehicle) {
    if (vehicle?.endorsements?.length > 0) {
        return vehicle.endorsements;
    }
    return [];
}
export function repairWaivedForSelectedVehicle(vehicle) {
    return vehicle?.endorsements?.includes(endorsementOptions.REPAIR_WAIVED) ?? false;
}
