package com.imcode.entities.embed;

import com.imcode.entities.AfterSchoolCenterSection;

import java.io.Serializable;
import java.time.DayOfWeek;
import javax.persistence.*;

/**
 * Created by vitaly on 14.05.15.
 */
//@Entity
//@Table(name = "dbo_after_school_center_schema")
@Embeddable
public class AfterSchoolCenterSchema implements Serializable {
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "after_school_section_id")
    private AfterSchoolCenterSection afrerSchoolSection;

    @Column(name = "day_of_week")
    @Enumerated(EnumType.STRING)
    private DayOfWeek dayOfWeek;

    @Column(name = "use_before_school")
    private Boolean useBeforeSchool = false;

    @Column(name = "use_after_school")
    private Boolean useAfterSchool = false;


    public AfterSchoolCenterSchema() {
    }

    public AfterSchoolCenterSchema(AfterSchoolCenterSection AfrerSchoolSection, DayOfWeek dayOfWeek, Boolean useBeforeSchool, Boolean useAfterSchool) {
        this.afrerSchoolSection = AfrerSchoolSection;
        this.dayOfWeek = dayOfWeek;
        this.useBeforeSchool = useBeforeSchool;
        this.useAfterSchool = useAfterSchool;
    }

    //AfterSchoolOnly
    public AfterSchoolCenterSchema(AfterSchoolCenterSection AfrerSchoolSection, DayOfWeek dayOfWeek) {
        this.afrerSchoolSection = AfrerSchoolSection;
        this.dayOfWeek = dayOfWeek;
//        this.useAfterSchool = true;
//        this.useBeforeSchool = false;
    }

    public AfterSchoolCenterSection getAfrerSchoolSection() {
        return afrerSchoolSection;
    }

    public void setAfrerSchoolSection(AfterSchoolCenterSection afterSchoolSection) {
        this.afrerSchoolSection = afterSchoolSection;
    }

    public DayOfWeek getDayOfWeek() {
        return dayOfWeek;
    }

    public void setDayOfWeek(DayOfWeek dayOfWeek) {
        this.dayOfWeek = dayOfWeek;
    }

    public Boolean isUseBeforeSchool() {
        return useBeforeSchool;
    }

    public void setUseBeforeSchool(Boolean useBeforeSchool) {
        this.useBeforeSchool = useBeforeSchool;
    }

    public Boolean isUseAfterSchool() {
        return useAfterSchool;
    }

    public void setUseAfterSchool(Boolean useAfterSchool) {
        this.useAfterSchool = useAfterSchool;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AfterSchoolCenterSchema that = (AfterSchoolCenterSchema) o;

        if (afrerSchoolSection != null ? !afrerSchoolSection.equals(that.afrerSchoolSection) : that.afrerSchoolSection != null)
            return false;
        return dayOfWeek == that.dayOfWeek;

    }

    @Override
    public int hashCode() {
        int result = afrerSchoolSection != null ? afrerSchoolSection.hashCode() : 0;
        result = 31 * result + (dayOfWeek != null ? dayOfWeek.hashCode() : 0);
        return result;
    }
}

@@ -471,25 +471,25 @@
 erSection af
-r
+t
 erSchoolSect
@@ -864,35 +864,35 @@
 olCenterSection 
-Afr
+aft
 erSchoolSection,
@@ -971,33 +971,33 @@
 %0A        this.af
-r
+t
 erSchoolSection 
@@ -990,35 +990,35 @@
 SchoolSection = 
-Afr
+aft
 erSchoolSection;
@@ -1237,19 +1237,19 @@
 Section 
-Afr
+aft
 erSchool
@@ -1287,33 +1287,33 @@
 %0A        this.af
-r
+t
 erSchoolSection 
@@ -1314,19 +1314,19 @@
 ction = 
-Afr
+aft
 erSchool
@@ -1492,25 +1492,25 @@
 ection getAf
-r
+t
 erSchoolSect
@@ -1534,17 +1534,17 @@
 eturn af
-r
+t
 erSchool
@@ -1580,17 +1580,17 @@
 id setAf
-r
+t
 erSchool
@@ -1659,17 +1659,17 @@
  this.af
-r
+t
 erSchool
@@ -2498,17 +2498,17 @@
   if (af
-r
+t
 erSchool
@@ -2528,17 +2528,17 @@
 ll ? !af
-r
+t
 erSchool
@@ -2555,25 +2555,25 @@
 uals(that.af
-r
+t
 erSchoolSect
@@ -2586,17 +2586,17 @@
  that.af
-r
+t
 erSchool
@@ -2755,17 +2755,17 @@
 ult = af
-r
+t
 erSchool
@@ -2784,17 +2784,17 @@
 ull ? af
-r
+t
 erSchool

Fix field name.