/*
 * Copyright (c) 2004, 2014 Lucas Holt
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

package com.justjournal.db;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;

/**
 * Represents a mood
 *
 * @author Lucas Holt
 */
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
public final class MoodTo {
    private int id;
    private int parent;  // parent mood
    private String name;

    @JsonCreator
    public MoodTo() {

    }

    public MoodTo(int id, String name) {
        this.id = id;
        this.parent = 0;
        this.name = name;
    }
    public MoodTo(int id, int parent, String name) {
        this.id = id;
        this.parent = parent;
        this.name = name;
    }

    public int getId() {
        return this.id;
    }

    public void setId(final int id) {
        this.id = id;
    }

    public int getParent() {
        return this.parent;
    }

    public void setParent(final int parent) {
        this.parent = parent;
    }

    public String getName() {
        return this.name;
    }

    public void setName(final String name) {
        this.name = name;
    }

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

        final MoodTo moodTo = (MoodTo) o;

        return id == moodTo.id && parent == moodTo.parent && name.equals(moodTo.name);
    }

    @Override
    public int hashCode() {
        int result;
        result = id;
        result = 29 * result + parent;
        result = 29 * result + name.hashCode();
        return result;
    }

    @Override
    public String toString() {
        return "id: " + id + ", parent: " + parent + ", name: " + name;
    }
}

@@ -1488,16 +1488,117 @@
 Creator;
+%0Aimport com.fasterxml.jackson.annotation.JsonIgnore;%0Aimport org.springframework.stereotype.Component;
 %0A%0A/**%0A *
@@ -1710,16 +1710,27 @@
 ty.ANY)%0A
+@Component%0A
 public f
@@ -1767,16 +1767,20 @@
 e int id
+ = 0
 ;%0A    pr
@@ -1795,16 +1795,20 @@
 t parent
+ = 0
 ;  // pa
@@ -1840,16 +1840,21 @@
 ing name
+ = %22%22
 ;%0A%0A    @
@@ -2556,32 +2556,48 @@
  = name;%0A    %7D%0A%0A
+    @JsonIgnore%0A
     @Override%0A  
@@ -2865,32 +2865,48 @@
 o.name);%0A    %7D%0A%0A
+    @JsonIgnore%0A
     @Override%0A  
@@ -3085,24 +3085,40 @@
 ult;%0A    %7D%0A%0A
+    @JsonIgnore%0A
     @Overrid

fix a few bugs