package com.example.pap_teste.models;

import java.io.Serializable;

public class ScheduleDay implements Serializable {
    private boolean closed;
    private Boolean isOpen;
    private String openTime;
    private String closeTime;

    public ScheduleDay() {
        // No-argument constructor for Firebase
    }

    public ScheduleDay(boolean closed, String openTime, String closeTime) {
        this.closed = closed;
        this.isOpen = !closed;
        this.openTime = openTime;
        this.closeTime = closeTime;
    }

    public boolean isClosed() {
        if (isOpen != null) {
            return !isOpen;
        }
        return closed;
    }

    public void setClosed(boolean closed) {
        this.closed = closed;
        if (this.isOpen == null) {
            this.isOpen = !closed;
        }
    }

    // Handles potential "isClosed" boolean in Firebase
    public void setIsClosed(Boolean isClosed) {
        if (isClosed != null) {
            this.closed = isClosed;
            this.isOpen = !isClosed;
        }
    }

    // Handles potential "fechado" boolean from Portuguese web dashboards
    public void setFechado(Boolean fechado) {
        if (fechado != null) {
            this.closed = fechado;
            this.isOpen = !fechado;
        }
    }

    @com.google.firebase.database.PropertyName("isOpen")
    public Boolean getIsOpen() {
        return isOpen;
    }

    @com.google.firebase.database.PropertyName("isOpen")
    public void setIsOpen(Boolean isOpen) {
        this.isOpen = isOpen;
    }

    public String getOpenTime() {
        return openTime;
    }

    public void setOpenTime(String openTime) {
        this.openTime = openTime;
    }

    public String getCloseTime() {
        return closeTime;
    }

    public void setCloseTime(String closeTime) {
        this.closeTime = closeTime;
    }
}
