/*
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
 */
package com.montealegreluis.yelpv3.businesses;

import org.json.JSONObject;

import java.time.DayOfWeek;
import java.time.LocalTime;

public class Hours {
    private boolean overnight = false;
    private DayOfWeek day;
    private LocalTime start;
    private LocalTime end;

    public static Hours from(JSONObject jsonHours) {
        return new Hours(jsonHours);
    }

    public boolean overnight() {
        return overnight;
    }

    public DayOfWeek day() {
        return day;
    }

    public LocalTime start() {
        return start;
    }

    public LocalTime end() {
        return end;
    }

    private Hours(JSONObject jsonHours) {
        this.start = createTimeFrom(jsonHours.getString("start"));
        this.end = createTimeFrom(jsonHours.getString("end"));
        day = DayOfWeek.of(jsonHours.getInt("day") + 1);
    }

    private LocalTime createTimeFrom(String text) {
        return LocalTime.of(
            Integer.valueOf(text.substring(0, 2)),
            Integer.valueOf(text.substring(2, 4))
        );
    }
}

@@ -261,22 +261,27 @@
  %7B%0A    p
-rivate
+ublic final
  boolean
@@ -305,22 +305,27 @@
 e;%0A    p
-rivate
+ublic final
  DayOfWe
@@ -333,30 +333,35 @@
 k day;%0A    p
-rivate
+ublic final
  LocalTime s
@@ -367,30 +367,35 @@
 start;%0A    p
-rivate
+ublic final
  LocalTime e
@@ -500,246 +500,8 @@
  %7D%0A%0A
-    public boolean overnight() %7B%0A        return overnight;%0A    %7D%0A%0A    public DayOfWeek day() %7B%0A        return day;%0A    %7D%0A%0A    public LocalTime start() %7B%0A        return start;%0A    %7D%0A%0A    public LocalTime end() %7B%0A        return end;%0A    %7D%0A%0A
     

Remove getters from Hours