import { randInt } from "../../util";
import { setDirectAnswerPreset } from "./util/answer-flow";
import { TAnswerFlow, TGlobalPresets } from "./util/types";

const EXPRESS_STORE_PRESET_3: TGlobalPresets = {
  contact_name: "",
  skincare: {
    thayers_oos_before: () => 3,
    thayers_stocked: () => randInt(5, 6),
    garnier_oos_before: () => randInt(3, 4),
    garnier_stocked: () => 5,
    loreal_oos_before: () => randInt(3, 4),
    loreal_stocked: () => 5,
  },
  haircare: {
    elvive_oos_before: () => 10,
    elvive_stocked: () => randInt(7, 10),
    ever_oos_before: () => randInt(4, 6),
    ever_stocked: () => randInt(7, 10),
    fructis_oos_before: () => randInt(4, 6),
    fructis_stocked: () => randInt(7, 10),
    whole_blends_oos_before: () => randInt(2, 4),
    whole_blends_stocked: () => randInt(3, 6),
    carols_daughter_oos_before: () => randInt(2, 4),
    carols_daughter_stocked: () => randInt(3, 6),
  },
  haircolor: {
    loreal_oos_before: () => randInt(7, 10),
    loreal_stocked: () => randInt(9, 10),
    garnier_oos_before: () => randInt(7, 10),
    garnier_stocked: () => randInt(9, 10),
    darknlovely_oos_before: () => randInt(2, 4),
    darknlovely_stocked: () => randInt(4, 5),
  },
  colorsonic: {
    before: () => 3,
    total_stocked: () => 10,
  },
  maybelline: {
    face_oos_before: () => randInt(13, 18),
    eye_oos_before: () => randInt(13, 18),
    lip_oos_before: () => randInt(14, 20),
    total_stocked: () => 40,
  },
  essie: {
    oos_before: () => randInt(11, 16),
    total_stocked: () => 15,
  },
  loreal: {
    face_oos_before: () => randInt(13, 18),
    eye_oos_before: () => randInt(13, 18),
    lip_oos_before: () => randInt(13, 19),
    total_stocked: () => 30,
  },
  nyx: {
    face_oos_before: () => randInt(13, 18),
    eye_oos_before: () => randInt(13, 18),
    lip_oos_before: () => randInt(14, 20),
    total_stocked: () => 30,
  },
};

const EXPRESS_STORE_PRESET_5: TGlobalPresets = {
  contact_name: "",
  skincare: {
    thayers_oos_before: () => 3,
    thayers_stocked: () => randInt(5, 6),
    garnier_oos_before: () => randInt(3, 4),
    garnier_stocked: () => 5,
    loreal_oos_before: () => randInt(3, 4),
    loreal_stocked: () => 5,
  },
  haircare: {
    elvive_oos_before: () => 10,
    elvive_stocked: () => randInt(7, 10),
    ever_oos_before: () => randInt(4, 6),
    ever_stocked: () => randInt(7, 10),
    fructis_oos_before: () => randInt(4, 6),
    fructis_stocked: () => randInt(7, 10),
    whole_blends_oos_before: () => randInt(2, 4),
    whole_blends_stocked: () => randInt(3, 6),
    carols_daughter_oos_before: () => randInt(2, 4),
    carols_daughter_stocked: () => randInt(3, 6),
  },
  haircolor: {
    loreal_oos_before: () => randInt(7, 10),
    loreal_stocked: () => randInt(9, 10),
    garnier_oos_before: () => randInt(7, 10),
    garnier_stocked: () => randInt(9, 10),
    darknlovely_oos_before: () => randInt(2, 4),
    darknlovely_stocked: () => randInt(4, 5),
  },
  colorsonic: {
    before: () => 3,
    total_stocked: () => 10,
  },
  maybelline: {
    total_stocked: () => 40,
    face_oos_before: () => randInt(8, 12),
    eye_oos_before: () => randInt(8, 13),
    lip_oos_before: () => randInt(9, 14),
  },
  essie: {
    oos_before: () => randInt(8, 11),
    total_stocked: () => 15,
  },
  loreal: {
    face_oos_before: () => randInt(9, 14),
    eye_oos_before: () => randInt(12, 15),
    lip_oos_before: () => randInt(5, 9),
    total_stocked: () => 30,
  },
  nyx: {
    face_oos_before: () => randInt(8, 13),
    eye_oos_before: () => randInt(10, 15),
    lip_oos_before: () => randInt(14, 19),
    total_stocked: () => 30,
  },
};

const LARGE_STORE_PRESET_5: TGlobalPresets = {
  contact_name: "",
  skincare: {
    thayers_oos_before: () => randInt(2, 3),
    thayers_stocked: () => randInt(5, 6),
    garnier_oos_before: () => randInt(3, 4),
    garnier_stocked: () => 5,
    loreal_oos_before: () => randInt(3, 4),
    loreal_stocked: () => 5,
  },
  haircare: {
    elvive_oos_before: () => 10,
    elvive_stocked: () => randInt(7, 10),
    ever_oos_before: () => randInt(4, 6),
    ever_stocked: () => randInt(7, 10),
    fructis_oos_before: () => randInt(4, 6),
    fructis_stocked: () => randInt(7, 10),
    whole_blends_oos_before: () => randInt(2, 4),
    whole_blends_stocked: () => randInt(3, 6),
    carols_daughter_oos_before: () => randInt(2, 4),
    carols_daughter_stocked: () => randInt(3, 6),
  },
  haircolor: {
    loreal_oos_before: () => randInt(7, 10),
    loreal_stocked: () => randInt(9, 10),
    garnier_oos_before: () => randInt(7, 10),
    garnier_stocked: () => randInt(9, 10),
    darknlovely_oos_before: () => randInt(2, 4),
    darknlovely_stocked: () => randInt(4, 5),
  },
  colorsonic: {
    before: () => 3,
    total_stocked: () => 10,
  },
  maybelline: {
    face_oos_before: () => randInt(13, 18),
    eye_oos_before: () => randInt(13, 18),
    lip_oos_before: () => randInt(14, 20),
    total_stocked: () => 40,
  },
  essie: {
    oos_before: () => randInt(11, 16),
    total_stocked: () => 15,
  },
  loreal: {
    face_oos_before: () => randInt(13, 18),
    eye_oos_before: () => randInt(13, 18),
    lip_oos_before: () => randInt(13, 19),
    total_stocked: () => 30,
  },
  nyx: {
    face_oos_before: () => randInt(13, 18),
    eye_oos_before: () => randInt(13, 18),
    lip_oos_before: () => randInt(14, 20),
    total_stocked: () => 30,
  },
};

const LARGE_STORE_PRESET_3: TGlobalPresets = {
  contact_name: "",
  skincare: {
    thayers_oos_before: () => randInt(2, 3),
    thayers_stocked: () => randInt(5, 6),
    garnier_oos_before: () => randInt(3, 4),
    garnier_stocked: () => 5,
    loreal_oos_before: () => randInt(3, 4),
    loreal_stocked: () => 5,
  },
  haircare: {
    elvive_oos_before: () => 10,
    elvive_stocked: () => randInt(7, 10),
    ever_oos_before: () => randInt(4, 6),
    ever_stocked: () => randInt(7, 10),
    fructis_oos_before: () => randInt(4, 6),
    fructis_stocked: () => randInt(7, 10),
    whole_blends_oos_before: () => randInt(2, 4),
    whole_blends_stocked: () => randInt(3, 6),
    carols_daughter_oos_before: () => randInt(2, 4),
    carols_daughter_stocked: () => randInt(3, 6),
  },
  haircolor: {
    loreal_oos_before: () => randInt(7, 10),
    loreal_stocked: () => randInt(9, 10),
    garnier_oos_before: () => randInt(7, 10),
    garnier_stocked: () => randInt(9, 10),
    darknlovely_oos_before: () => randInt(2, 4),
    darknlovely_stocked: () => randInt(4, 5),
  },
  colorsonic: {
    before: () => 3,
    total_stocked: () => 10,
  },
  maybelline: {
    face_oos_before: () => randInt(10, 15),
    eye_oos_before: () => randInt(10, 15),
    lip_oos_before: () => randInt(11, 17),
    total_stocked: () => 40,
  },
  essie: {
    oos_before: () => randInt(9, 13),
    total_stocked: () => 15,
  },
  loreal: {
    face_oos_before: () => randInt(10, 15),
    eye_oos_before: () => randInt(10, 15),
    lip_oos_before: () => randInt(10, 16),
    total_stocked: () => 30,
  },
  nyx: {
    face_oos_before: () => randInt(10, 15),
    eye_oos_before: () => randInt(10, 15),
    lip_oos_before: () => randInt(11, 17),
    total_stocked: () => 30,
  },
};

export const GLOBAL_PRESETS: Record<string, TGlobalPresets> = {
  "T1150 College Point Target": {
    ...LARGE_STORE_PRESET_5,
    contact_name: "Natalia, LOD",
  },
  "T1344 Queens Place Target": {
    ...LARGE_STORE_PRESET_5,
    contact_name: "Danica, LOD",
  },
  "T2451 Flushing Target": {
    ...LARGE_STORE_PRESET_3,
    contact_name: "Erica, LOD",
  },
  "T3312 New York Target": {
    ...EXPRESS_STORE_PRESET_5,
    contact_name: "Janet, LOD",
  },
  "T3284 Grand St Target": {
    ...EXPRESS_STORE_PRESET_3,
    contact_name: "Lynecia, LOD",
  },
};

export const BOILERPLATE_ANSWER_FLOWS: Record<number, TAnswerFlow> = {
  0: setDirectAnswerPreset(
    undefined,
    "Additional Task Status",
    "radio",
    () => "I completed my Additional Task for this category scheduled this week today.",
  ),
  3: setDirectAnswerPreset(
    undefined,
    "Did you have remaining service time after all assigned service objectives were complete to zone or stock other NOT-assigned categories",
    "radio",
    () => "No",
  ),
  4: setDirectAnswerPreset(
    undefined,
    "Did the store correct any inaccurate counts for items that were NOT out of stock - just incorrect",
    "text",
    () => 0,
  ),
  5: setDirectAnswerPreset(
    undefined,
    "What is the name and title of the Team Lead you reviewed your service with",
    "text",
    (storeLabel) => GLOBAL_PRESETS[storeLabel].contact_name,
  ),
  6: setDirectAnswerPreset(
    undefined,
    /Did you help a guest get a locked Skin Care case.*open today/i,
    "radio",
    () =>
      "Yes, I was able to get a key or a Team Member with a key to unlock cases for Guests during this service",
  ),
  7: setDirectAnswerPreset(
    undefined,
    "If yes, how many Guests did you assist with opening locked cases today",
    "text",
    () => randInt(3, 5),
  ),
  8: setDirectAnswerPreset(
    undefined,
    "Did you help a guest with any of the L’Oreal brands today",
    "radio",
    () => "Yes",
  ),
  9: setDirectAnswerPreset(undefined, "If yes, how many guests did you assist today", "text", () =>
    randInt(2, 4),
  ),
  10: setDirectAnswerPreset(
    undefined,
    "Have you worked the full",
    "radio",
    () => "Yes I have some time left to service",
  ),
};
