/*
 *  Copyright (c) 2017 Otávio Santana and others
 *   All rights reserved. This program and the accompanying materials
 *   are made available under the terms of the Eclipse Public License v1.0
 *   and Apache License v2.0 which accompanies this distribution.
 *   The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 *   and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
 *
 *   You may elect to redistribute this code under either of these licenses.
 *
 *   Contributors:
 *
 *   Otavio Santana
 */
package org.jnosql.artemis.graph.model;

import org.jnosql.artemis.Column;
import org.jnosql.artemis.Entity;
import org.jnosql.artemis.Id;

import java.util.Objects;

@Entity
public class Book {

    @Id
    private String id;

    @Column
    private String name;

    @Column
    private Integer age;


    Book() {
    }

    Book(String id, String name, Integer age) {
        this.id = id;
        this.name = name;
        this.age = age;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public Integer getAge() {
        return age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Book)) {
            return false;
        }
        Book book = (Book) o;
        return Objects.equals(id, book.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Book{");
        sb.append("id='").append(id).append('\'');
        sb.append(", name='").append(name).append('\'');
        sb.append(", age=").append(age);
        sb.append('}');
        return sb.toString();
    }


    public static BookBuilder builder() {
        return new BookBuilder();
    }

    public static class BookBuilder {
        private String name;
        private Integer age;
        private String id;

        private BookBuilder() {
        }

        public BookBuilder withName(String name) {
            this.name = name;
            return this;
        }

        public BookBuilder withAge(Integer age) {
            this.age = age;
            return this;
        }

        public BookBuilder withId(String id) {
            this.id = id;
            return this;
        }

        public Book build() {
            return new Book(id, name, age);
        }
    }
}

@@ -782,36 +782,34 @@
 @Id%0A    private 
-Stri
+Lo
 ng id;%0A%0A    @Col
@@ -906,20 +906,18 @@
    Book(
-Stri
+Lo
 ng id, S
@@ -1029,28 +1029,26 @@
 %0A    public 
-Stri
+Lo
 ng getId() %7B
@@ -2052,20 +2052,18 @@
 private 
-Stri
+Lo
 ng id;%0A%0A
@@ -2370,20 +2370,18 @@
  withId(
-Stri
+Lo
 ng id) %7B

defines Book id as Long