package com.yoelglus.presentation.patterns.model;

import com.yoelglus.presentation.patterns.entities.Item;

public class ItemModel {
    private final String id;
    private final String content;
    private final String detail;

    private ItemModel(String id, String content, String detail) {
        this.id = id;
        this.content = content;
        this.detail = detail;
    }

    public String getId() {
        return id;
    }

    public String getContent() {
        return content;
    }

    public String getDetail() {
        return detail;
    }

    public static ItemModel from(Item item) {
        return new ItemModel(item.getId(), item.getContent(), item.getDetail());
    }

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

        ItemModel itemModel = (ItemModel) o;

        if (mId != null ? !mId.equals(itemModel.mId) : itemModel.mId != null) {
            return false;
        }
        if (mContent != null ? !mContent.equals(itemModel.mContent) : itemModel.mContent != null) {
            return false;
        }
        return mDetail != null ? mDetail.equals(itemModel.mDetail) : itemModel.mDetail == null;

    }

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

@@ -957,18 +957,17 @@
     if (
-mI
+i
 d != nul
@@ -971,18 +971,17 @@
 null ? !
-mI
+i
 d.equals
@@ -991,18 +991,17 @@
 emModel.
-mI
+i
 d) : ite
@@ -1007,18 +1007,17 @@
 emModel.
-mI
+i
 d != nul
@@ -1069,18 +1069,17 @@
     if (
-mC
+c
 ontent !
@@ -1088,18 +1088,17 @@
 null ? !
-mC
+c
 ontent.e
@@ -1109,26 +1109,25 @@
 s(itemModel.
-mC
+c
 ontent) : it
@@ -1134,18 +1134,17 @@
 emModel.
-mC
+c
 ontent !
@@ -1204,18 +1204,17 @@
  return 
-mD
+d
 etail !=
@@ -1217,26 +1217,25 @@
 l != null ? 
-mD
+d
 etail.equals
@@ -1241,26 +1241,25 @@
 s(itemModel.
-mD
+d
 etail) : ite
@@ -1265,18 +1265,17 @@
 emModel.
-mD
+d
 etail ==
@@ -1352,18 +1352,17 @@
 esult = 
-mI
+i
 d != nul
@@ -1369,10 +1369,9 @@
 l ? 
-mI
+i
 d.ha
@@ -1416,18 +1416,17 @@
 sult + (
-mC
+c
 ontent !
@@ -1438,10 +1438,9 @@
 l ? 
-mC
+c
 onte
@@ -1491,18 +1491,17 @@
 sult + (
-mD
+d
 etail !=
@@ -1512,10 +1512,9 @@
 l ? 
-mD
+d
 etai

update equals and hascode to new style