module FFaker::PhoneNumberSE

def area_prefix

def area_prefix
  fetch_sample(PHONE_PREFIX)
end

def country_prefix

def country_prefix
  fetch_sample(COUNTRY_PREFIX)
end

def home_work_phone_number

def home_work_phone_number
  FFaker.numerify("0#{phone_number_format}")
end

def international_home_work_phone_number

def international_home_work_phone_number
  FFaker.numerify("#{country_prefix} (0)#{phone_number_format}")
end

def international_mobile_phone_number

def international_mobile_phone_number
  FFaker.numerify("#{country_prefix} (0)#{mobile_phone_number_format}")
end

def international_phone_number

def international_phone_number
  case rand(0..1)
  when 0 then international_mobile_phone_number
  when 1 then international_home_work_phone_number
  end
end

def mobile_phone_number

def mobile_phone_number
  FFaker.numerify("0#{mobile_phone_number_format}")
end

def mobile_phone_number_format

def mobile_phone_number_format
  fetch_sample(MOBILE_PHONE_FORMAT) % mobile_prefix
end

def mobile_prefix

def mobile_prefix
  fetch_sample(MOBILE_PHONE_PREFIX)
end

def phone_number

def phone_number
  case rand(0..1)
  when 0 then home_work_phone_number
  when 1 then mobile_phone_number
  end
end

def phone_number_format

def phone_number_format
  prefix = area_prefix
  case prefix.length
  when 1 then fetch_sample(PHONE_FORMAT_PREFIX_2)
  when 2 then fetch_sample(PHONE_FORMAT_PREFIX_3)
  when 3 then fetch_sample(PHONE_FORMAT_PREFIX_4)
  end % prefix
end