<?php

namespace App\Http\Controllers;

abstract class Controller
{
    protected $jobs = '[
  {
    "user_id": 1,
    "job_title": "Software Engineer",
    "company_name": "TechCorp",
    "level": "Mid",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Develop and maintain web applications.",
    "industry": "Technology",
    "company_size": "201-500",
    "employment_month": 1,
    "employment_year": 2021,
    "number_of_years_as_employee": 2,
    "years_of_experience": 4,
    "years_in_level": 2,
    "location": "New York",
    "city": "New York",
    "post_code": "10001",
    "state": "NY",
    "country": "United States",
    "work_arrangement": "Remote",
    "employment_type": "Permanent",
    "annual_base_salary": 90000,
    "bonus_commission": 5000,
    "overtime_pay": 2000,
    "equity": 1000,
    "currency": "USD",
    "benefits": "Health, Dental, 401k",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "Frontend Developer",
    "company_name": "WebSolutions",
    "level": "Junior",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Build and maintain UI components.",
    "industry": "Technology",
    "company_size": "51-200",
    "employment_month": 3,
    "employment_year": 2022,
    "number_of_years_as_employee": 1,
    "years_of_experience": 2,
    "years_in_level": 1,
    "location": "San Francisco",
    "city": "San Francisco",
    "post_code": "94105",
    "state": "CA",
    "country": "United States",
    "work_arrangement": "Hybrid",
    "employment_type": "Permanent",
    "annual_base_salary": 75000,
    "bonus_commission": 3000,
    "overtime_pay": 1500,
    "equity": 0,
    "currency": "USD",
    "benefits": "Health, Stock Options",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "Data Analyst",
    "company_name": "DataWorks",
    "level": "Senior",
    "work_status": "Full-time",
    "still_employed": false,
    "job_description": "Analyze business data for insights.",
    "industry": "Analytics",
    "company_size": "501-1000",
    "employment_month": 6,
    "employment_year": 2019,
    "number_of_years_as_employee": 3,
    "years_of_experience": 5,
    "years_in_level": 2,
    "location": "Chicago",
    "city": "Chicago",
    "post_code": "60601",
    "state": "IL",
    "country": "United States",
    "work_arrangement": "On-site",
    "employment_type": "Contract",
    "annual_base_salary": 85000,
    "bonus_commission": 4000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "USD",
    "benefits": "Health, Paid Vacation",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "Backend Developer",
    "company_name": "CodeBase",
    "level": "Mid",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Develop server-side APIs.",
    "industry": "Technology",
    "company_size": "201-500",
    "employment_month": 5,
    "employment_year": 2020,
    "number_of_years_as_employee": 2,
    "years_of_experience": 3,
    "years_in_level": 1,
    "location": "Austin",
    "city": "Austin",
    "post_code": "73301",
    "state": "TX",
    "country": "United States",
    "work_arrangement": "Remote",
    "employment_type": "Permanent",
    "annual_base_salary": 88000,
    "bonus_commission": 3500,
    "overtime_pay": 1000,
    "equity": 0,
    "currency": "USD",
    "benefits": "Health, 401k",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "Project Manager",
    "company_name": "BuildIt",
    "level": "Senior",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Manage software projects and teams.",
    "industry": "Construction",
    "company_size": "1001-5000",
    "employment_month": 2,
    "employment_year": 2018,
    "number_of_years_as_employee": 4,
    "years_of_experience": 6,
    "years_in_level": 3,
    "location": "Seattle",
    "city": "Seattle",
    "post_code": "98101",
    "state": "WA",
    "country": "United States",
    "work_arrangement": "On-site",
    "employment_type": "Permanent",
    "annual_base_salary": 95000,
    "bonus_commission": 6000,
    "overtime_pay": 0,
    "equity": 2000,
    "currency": "USD",
    "benefits": "Health, Stock Options",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "UI/UX Designer",
    "company_name": "DesignHub",
    "level": "Mid",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Design user interfaces and experiences.",
    "industry": "Design",
    "company_size": "51-200",
    "employment_month": 7,
    "employment_year": 2021,
    "number_of_years_as_employee": 1,
    "years_of_experience": 3,
    "years_in_level": 1,
    "location": "Boston",
    "city": "Boston",
    "post_code": "02101",
    "state": "MA",
    "country": "United States",
    "work_arrangement": "Hybrid",
    "employment_type": "Permanent",
    "annual_base_salary": 78000,
    "bonus_commission": 2000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "USD",
    "benefits": "Health, Paid Vacation",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "QA Engineer",
    "company_name": "TestLabs",
    "level": "Junior",
    "work_status": "Full-time",
    "still_employed": false,
    "job_description": "Test software applications for quality.",
    "industry": "Technology",
    "company_size": "201-500",
    "employment_month": 4,
    "employment_year": 2020,
    "number_of_years_as_employee": 1,
    "years_of_experience": 2,
    "years_in_level": 1,
    "location": "Denver",
    "city": "Denver",
    "post_code": "80201",
    "state": "CO",
    "country": "United States",
    "work_arrangement": "Remote",
    "employment_type": "Contract",
    "annual_base_salary": 65000,
    "bonus_commission": 1000,
    "overtime_pay": 500,
    "equity": 0,
    "currency": "USD",
    "benefits": "Health",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "DevOps Engineer",
    "company_name": "CloudOps",
    "level": "Mid",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Maintain cloud infrastructure.",
    "industry": "Technology",
    "company_size": "501-1000",
    "employment_month": 8,
    "employment_year": 2019,
    "number_of_years_as_employee": 3,
    "years_of_experience": 5,
    "years_in_level": 2,
    "location": "Miami",
    "city": "Miami",
    "post_code": "33101",
    "state": "FL",
    "country": "United States",
    "work_arrangement": "On-site",
    "employment_type": "Permanent",
    "annual_base_salary": 87000,
    "bonus_commission": 4000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "USD",
    "benefits": "Health, 401k",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "Business Analyst",
    "company_name": "BizInsights",
    "level": "Senior",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Analyze business processes and metrics.",
    "industry": "Consulting",
    "company_size": "1001-5000",
    "employment_month": 9,
    "employment_year": 2020,
    "number_of_years_as_employee": 2,
    "years_of_experience": 6,
    "years_in_level": 3,
    "location": "Atlanta",
    "city": "Atlanta",
    "post_code": "30301",
    "state": "GA",
    "country": "United States",
    "work_arrangement": "Hybrid",
    "employment_type": "Permanent",
    "annual_base_salary": 93000,
    "bonus_commission": 5000,
    "overtime_pay": 0,
    "equity": 1000,
    "currency": "USD",
    "benefits": "Health, Stock Options",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },{
    "user_id": 1,
    "job_title": "Software Developer",
    "company_name": "MapleTech",
    "level": "Mid",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Developing web applications and APIs.",
    "industry": "Technology",
    "company_size": "51-200",
    "employment_month": "01",
    "employment_year": "2022",
    "number_of_years_as_employee": 1,
    "years_of_experience": 3,
    "years_in_level": 1,
    "location": "Toronto",
    "city": "Toronto",
    "post_code": "M5H 2N2",
    "state": "Ontario",
    "country": "Canada",
    "work_arrangement": "Hybrid",
    "employment_type": "Permanent",
    "annual_base_salary": 85000,
    "bonus_commission": 5000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "CAD",
    "benefits": "Health, Dental, Vision",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "UI/UX Designer",
    "company_name": "NorthernDesigns",
    "level": "Senior",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Designing user interfaces and experiences.",
    "industry": "Design",
    "company_size": "11-50",
    "employment_month": "03",
    "employment_year": "2021",
    "number_of_years_as_employee": 2,
    "years_of_experience": 6,
    "years_in_level": 2,
    "location": "Vancouver",
    "city": "Vancouver",
    "post_code": "V6B 1L1",
    "state": "British Columbia",
    "country": "Canada",
    "work_arrangement": "Remote",
    "employment_type": "Permanent",
    "annual_base_salary": 90000,
    "bonus_commission": 7000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "CAD",
    "benefits": "Health, Dental, Vision",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "Project Manager",
    "company_name": "MapleSolutions",
    "level": "Mid",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Managing IT projects and teams.",
    "industry": "Technology",
    "company_size": "201-500",
    "employment_month": "06",
    "employment_year": "2020",
    "number_of_years_as_employee": 3,
    "years_of_experience": 5,
    "years_in_level": 2,
    "location": "Montreal",
    "city": "Montreal",
    "post_code": "H2X 1S1",
    "state": "Quebec",
    "country": "Canada",
    "work_arrangement": "Hybrid",
    "employment_type": "Permanent",
    "annual_base_salary": 95000,
    "bonus_commission": 10000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "CAD",
    "benefits": "Health, Dental, Vision, Pension",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "Data Analyst",
    "company_name": "TrueNorth Analytics",
    "level": "Junior",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Analyzing business data to provide insights.",
    "industry": "Analytics",
    "company_size": "51-200",
    "employment_month": "02",
    "employment_year": "2023",
    "number_of_years_as_employee": 1,
    "years_of_experience": 2,
    "years_in_level": 1,
    "location": "Ottawa",
    "city": "Ottawa",
    "post_code": "K1P 5G4",
    "state": "Ontario",
    "country": "Canada",
    "work_arrangement": "Remote",
    "employment_type": "Permanent",
    "annual_base_salary": 70000,
    "bonus_commission": 3000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "CAD",
    "benefits": "Health, Dental",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "DevOps Engineer",
    "company_name": "MapleTech",
    "level": "Mid",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Manage CI/CD pipelines and cloud infrastructure.",
    "industry": "Technology",
    "company_size": "51-200",
    "employment_month": "05",
    "employment_year": "2021",
    "number_of_years_as_employee": 2,
    "years_of_experience": 4,
    "years_in_level": 2,
    "location": "Toronto",
    "city": "Toronto",
    "post_code": "M5H 2N2",
    "state": "Ontario",
    "country": "Canada",
    "work_arrangement": "Hybrid",
    "employment_type": "Permanent",
    "annual_base_salary": 95000,
    "bonus_commission": 5000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "CAD",
    "benefits": "Health, Dental, Vision, Pension",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "Marketing Specialist",
    "company_name": "GreatNorth Media",
    "level": "Junior",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Manage digital marketing campaigns.",
    "industry": "Marketing",
    "company_size": "11-50",
    "employment_month": "07",
    "employment_year": "2022",
    "number_of_years_as_employee": 1,
    "years_of_experience": 2,
    "years_in_level": 1,
    "location": "Vancouver",
    "city": "Vancouver",
    "post_code": "V6B 1L1",
    "state": "British Columbia",
    "country": "Canada",
    "work_arrangement": "Remote",
    "employment_type": "Permanent",
    "annual_base_salary": 60000,
    "bonus_commission": 2000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "CAD",
    "benefits": "Health, Dental",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "HR Manager",
    "company_name": "Maple Solutions",
    "level": "Senior",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Manage HR operations and recruitment.",
    "industry": "HR",
    "company_size": "51-200",
    "employment_month": "09",
    "employment_year": "2020",
    "number_of_years_as_employee": 3,
    "years_of_experience": 8,
    "years_in_level": 3,
    "location": "Toronto",
    "city": "Toronto",
    "post_code": "M5H 2N2",
    "state": "Ontario",
    "country": "Canada",
    "work_arrangement": "Hybrid",
    "employment_type": "Permanent",
    "annual_base_salary": 85000,
    "bonus_commission": 4000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "CAD",
    "benefits": "Health, Dental, Vision, Pension",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "Business Analyst",
    "company_name": "Northern Consulting",
    "level": "Mid",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Analyze business requirements and processes.",
    "industry": "Consulting",
    "company_size": "201-500",
    "employment_month": "04",
    "employment_year": "2021",
    "number_of_years_as_employee": 2,
    "years_of_experience": 4,
    "years_in_level": 2,
    "location": "Montreal",
    "city": "Montreal",
    "post_code": "H2X 1S1",
    "state": "Quebec",
    "country": "Canada",
    "work_arrangement": "Hybrid",
    "employment_type": "Permanent",
    "annual_base_salary": 78000,
    "bonus_commission": 3000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "CAD",
    "benefits": "Health, Dental, Vision",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "QA Engineer",
    "company_name": "MapleTech",
    "level": "Junior",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Test software applications and report bugs.",
    "industry": "Technology",
    "company_size": "51-200",
    "employment_month": "02",
    "employment_year": "2023",
    "number_of_years_as_employee": 1,
    "years_of_experience": 2,
    "years_in_level": 1,
    "location": "Toronto",
    "city": "Toronto",
    "post_code": "M5H 2N2",
    "state": "Ontario",
    "country": "Canada",
    "work_arrangement": "Hybrid",
    "employment_type": "Permanent",
    "annual_base_salary": 65000,
    "bonus_commission": 2000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "CAD",
    "benefits": "Health, Dental",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "Content Writer",
    "company_name": "GreatNorth Media",
    "level": "Junior",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Write blogs and marketing content.",
    "industry": "Marketing",
    "company_size": "11-50",
    "employment_month": "06",
    "employment_year": "2022",
    "number_of_years_as_employee": 1,
    "years_of_experience": 2,
    "years_in_level": 1,
    "location": "Vancouver",
    "city": "Vancouver",
    "post_code": "V6B 1L1",
    "state": "British Columbia",
    "country": "Canada",
    "work_arrangement": "Remote",
    "employment_type": "Permanent",
    "annual_base_salary": 55000,
    "bonus_commission": 1000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "CAD",
    "benefits": "Health, Dental",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  },
  {
    "user_id": 1,
    "job_title": "Network Engineer",
    "company_name": "NorthernTech",
    "level": "Mid",
    "work_status": "Full-time",
    "still_employed": true,
    "job_description": "Maintain network infrastructure and security.",
    "industry": "Technology",
    "company_size": "51-200",
    "employment_month": "03",
    "employment_year": "2021",
    "number_of_years_as_employee": 2,
    "years_of_experience": 5,
    "years_in_level": 2,
    "location": "Calgary",
    "city": "Calgary",
    "post_code": "T2P 1J9",
    "state": "Alberta",
    "country": "Canada",
    "work_arrangement": "Hybrid",
    "employment_type": "Permanent",
    "annual_base_salary": 87000,
    "bonus_commission": 4000,
    "overtime_pay": 0,
    "equity": 0,
    "currency": "CAD",
    "benefits": "Health, Dental, Vision",
    "is_published": true,
    "published_at": "2026-02-20T00:00:00Z",
    "created_at": "2026-02-20T00:00:00Z",
    "updated_at": "2026-02-20T00:00:00Z"
  }
]';


    protected function getJobs(): array
    {
        return json_decode($this->jobs, true);
    }

    /**
     * Get N random jobs
     */
    protected function getRandomJobs(int $count = 3): array
    {
        $jobsArray = $this->getJobs();
        shuffle($jobsArray);
        return array_slice($jobsArray, 0, $count);
    }

    /**
     * Get jobs filtered by country
     */
    protected function getJobsByCountry(string $country): array
    {
        return array_filter($this->getJobs(), fn($job) => $job['country'] === $country);
    }

    /**
     * Get N random jobs filtered by country
     */
    protected function getRandomJobsByCountry(string $country, int $count = 3): array
    {
        $jobsByCountry = $this->getJobsByCountry($country);
        $jobsByCountry = array_values($jobsByCountry); // reindex
        shuffle($jobsByCountry);
        return array_slice($jobsByCountry, 0, $count);
    }
}
