package com.sf._04_set_contact.demo2;

import java.util.Objects;

/**
 * 兑换商品类
 */
public class ExchangeGoods {
    private String code;  // 商品编码
    private String name;  // 商品名称
    private int points;   // 所需积分

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ExchangeGoods goods = (ExchangeGoods) o;
        return points == goods.points &&
                Objects.equals(code, goods.code) &&
                Objects.equals(name, goods.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(code, name, points);
    }

    public ExchangeGoods() {
    }

    public ExchangeGoods(String code, String name, int points) {
        this.code = code;
        this.name = name;
        this.points = points;
    }

    /**
     * 获取
     * @return code
     */
    public String getCode() {
        return code;
    }

    /**
     * 设置
     * @param code
     */
    public void setCode(String code) {
        this.code = code;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return points
     */
    public int getPoints() {
        return points;
    }

    /**
     * 设置
     * @param points
     */
    public void setPoints(int points) {
        this.points = points;
    }

    public String toString() {
        return "ExchangeGoods{code = " + code + ", name = " + name + ", points = " + points + "}";
    }
}
