import { GLOBAL_PRESETS } from "../global-presets";
import { setDependentAnswerPreset, setDirectAnswerPreset } from "../util/answer-flow";
import { TAnswerFlow } from "../util/types";
import * as beautyUtils from "../util/utils";

export const HAIRCOLOR_ANSWER_FLOWS: Record<number, TAnswerFlow> = {
  /**************** Upon Arrival: # of OOS ****************/
  10: setDirectAnswerPreset(
    undefined,
    "L'Oreal Hair Color Category - UPON ARRIVAL, BEFORE zoning or stocking, please count how many items are out of stock in the L'Oreal Hair Color category",
    "text",
    (storeLabel) => GLOBAL_PRESETS[storeLabel].haircolor.loreal_oos_before(),
  ),
  11: setDirectAnswerPreset(
    undefined,
    "Garnier Hair Color Category - UPON ARRIVAL, BEFORE zoning or stocking, please count how many items are out of stock in the Garnier Hair Color category",
    "text",
    (storeLabel) => GLOBAL_PRESETS[storeLabel].haircolor.garnier_oos_before(),
  ),
  12: setDirectAnswerPreset(
    undefined,
    "Dark & Lovely Hair Color Category - UPON ARRIVAL, BEFORE zoning or stocking, please count how many items are out of stock in the Dark & Lovely Hair Color category",
    "text",
    (storeLabel) => GLOBAL_PRESETS[storeLabel].haircolor.darknlovely_oos_before(),
  ),

  /**************** Total Items Stocked ****************/
  20: setDirectAnswerPreset(
    undefined,
    "What is the total number of pieces of L'Oreal Hair Color you stocked today",
    "text",
    (storeLabel) => GLOBAL_PRESETS[storeLabel].haircolor.loreal_stocked(),
  ),
  21: setDirectAnswerPreset(
    undefined,
    "What is the total number of pieces of Garnier Hair Color you stocked today",
    "text",
    (storeLabel) => GLOBAL_PRESETS[storeLabel].haircolor.garnier_stocked(),
  ),
  22: setDirectAnswerPreset(
    undefined,
    "What is the total number of pieces of Dark & Lovely Hair Color you stocked today",
    "text",
    (storeLabel) => GLOBAL_PRESETS[storeLabel].haircolor.darknlovely_stocked(),
  ),

  /**************** Upon Completion: # of OOS ****************/
  30: setDependentAnswerPreset(
    undefined,
    "L'Oreal Hair Color: After Zoning/Stocking/Merchandising, what is the Total # of Out Of Stocks during this visit",
    "text",
    [10],
    beautyUtils.getAfterOOSCount,
  ),
  31: setDependentAnswerPreset(
    undefined,
    "Garnier Hair Color: After Zoning/Stocking/Merchandising, what is the Total # of Out Of Stocks during this visit",
    "text",
    [11],
    beautyUtils.getAfterOOSCount,
  ),
  32: setDependentAnswerPreset(
    undefined,
    "Dark & Lovely Hair Color: After Zoning/Stocking/Merchandising, what is the Total # of Out Of Stocks during this visit",
    "text",
    [12],
    beautyUtils.getAfterOOSCount,
  ),

  /**************** On-hand Discrepancies ****************/
  40: setDependentAnswerPreset(
    undefined,
    "L'Oreal Hair Color: How many Out Of Stock items with 0 in the backroom show an on hand count (on hand in parentheses) greater than 0",
    "text",
    [30],
    beautyUtils.getOOSWithOnHandsGreaterThanZero,
  ),
  41: setDependentAnswerPreset(
    undefined,
    "Garnier Hair Color: How many Out Of Stock items with 0 in the backroom show an on hand count (on hand in parentheses) greater than 0",
    "text",
    [31],
    beautyUtils.getOOSWithOnHandsGreaterThanZero,
  ),
  42: setDependentAnswerPreset(
    undefined,
    "Dark & Lovely Hair Color: How many Out Of Stock items with 0 in the backroom show an on hand count (on hand in parentheses) greater than 0",
    "text",
    [32],
    beautyUtils.getOOSWithOnHandsGreaterThanZero,
  ),

  /**************** Count Corrections / DPCIs Corrected ****************/
  50: setDependentAnswerPreset(
    undefined,
    "L'Oreal Hair Color: What is the total number DPCIs in which the counts WERE CORRECTED",
    "text",
    [40],
    beautyUtils.getTotalDPCIsCountCorrected,
  ),
  51: setDependentAnswerPreset(
    undefined,
    "Garnier Hair Color: What is the total number DPCIs in which the counts WERE CORRECTED",
    "text",
    [41],
    beautyUtils.getTotalDPCIsCountCorrected,
  ),
  52: setDependentAnswerPreset(
    undefined,
    "Dark & Lovely Hair Color: What is the total number DPCIs in which the counts WERE CORRECTED",
    "text",
    [42],
    beautyUtils.getTotalDPCIsCountCorrected,
  ),

  /**************** Closing Questions ****************/
  60: setDependentAnswerPreset(
    undefined,
    "Did a Team Lead assist you during your service to correct any Hair Color",
    "radio",
    [40, 41, 42],
    beautyUtils.getDidATeamMemberAssistYouWithUpdatingOnHands,
  ),
};
