/**
 * Integration Tests: Profile Industry & Country Data Consistency
 *
 * These tests verify data consistency between:
 * 1. Signup form industry/country values
 * 2. Profile form industry/country values
 * 3. Database field mappings
 *
 * BUG PREVENTION: Ensures industry and country values are consistent
 * between signup form, database storage, and profile display.
 *
 * NOTE: API route tests are in __tests__/api/onboarding/company-info.test.ts
 */

describe("Profile Industry & Country Data Consistency Tests", () => {
  describe("Data Consistency Checks", () => {
    test("profile dropdown values should match signup form values", () => {
      // These are the industry values used in signup form
      const signupIndustries = [
        "healthcare",
        "beauty-wellness",
        "dental",
        "aesthetics",
        "medical-spas",
        "physio",
        "labs-diagnostics",
        "telehealth",
        "vet",
        "food-hospitality",
        "restaurants-cafes",
        "hotels-accommodation",
        "mobility-industry",
        "vehicle-rental",
        "education",
        "sports-academies",
        "events-venues",
        "property-facilities",
        "home-services-trades",
        "pet-services",
        "public-sector",
        "nonprofit-community",
        "retail-services",
        "other",
      ];

      // These are the industry values in ProfileTab dropdown
      const profileIndustries = [
        "healthcare",
        "dental",
        "aesthetics",
        "medical-spas",
        "physio",
        "labs-diagnostics",
        "telehealth",
        "vet",
        "beauty-wellness",
        "food-hospitality",
        "restaurants-cafes",
        "hotels-accommodation",
        "mobility-industry",
        "vehicle-rental",
        "education",
        "sports-academies",
        "events-venues",
        "property-facilities",
        "home-services-trades",
        "pet-services",
        "retail-services",
        "public-sector",
        "nonprofit-community",
        "other",
      ];

      // Every signup industry should exist in profile dropdown
      for (const industry of signupIndustries) {
        expect(profileIndustries).toContain(industry);
      }
    });

    test("profile country values should use full names not codes", () => {
      const profileCountries = [
        "Qatar",
        "UAE",
        "Saudi Arabia",
        "Kuwait",
        "Bahrain",
        "Oman",
      ];

      // Country codes (excluding UAE which is both a code and full name)
      const countryCodes = ["qa", "sa", "kw", "bh", "om"];

      // Profile should use full names - UAE is a special case as it's an acronym
      for (const country of profileCountries) {
        // All names should be at least 2 chars
        expect(country.length).toBeGreaterThanOrEqual(2);
      }

      // Profile should NOT use lowercase codes (except UAE which is valid)
      for (const code of countryCodes) {
        expect(profileCountries.map((c) => c.toLowerCase())).not.toContain(
          code,
        );
      }

      // Verify UAE is included as a full country name
      expect(profileCountries).toContain("UAE");
    });

    test("GCC_COUNTRY_MAP should cover all signup country codes", () => {
      const GCC_COUNTRY_MAP: Record<string, string> = {
        sa: "Saudi Arabia",
        uae: "UAE",
        qa: "Qatar",
        kw: "Kuwait",
        bh: "Bahrain",
        om: "Oman",
      };

      const signupCountryCodes = ["sa", "uae", "qa", "kw", "bh", "om"];

      for (const code of signupCountryCodes) {
        expect(GCC_COUNTRY_MAP[code]).toBeDefined();
        expect(GCC_COUNTRY_MAP[code].length).toBeGreaterThan(2);
      }
    });
  });
});
