package com.sf._04_set_contact.demo2;

import java.util.Objects;

/**
 * 会员类
 */
public class Member {
    private Long id;    // 会员id
    private String name;  // 会员名称
    private int leftPoints;  // 会员剩余积分

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Member member = (Member) o;
        return leftPoints == member.leftPoints &&
                Objects.equals(id, member.id) &&
                Objects.equals(name, member.name);
    }

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

    public Member() {
    }

    public Member(Long id, String name, int leftPoints) {
        this.id = id;
        this.name = name;
        this.leftPoints = leftPoints;
    }

    /**
     * 获取
     * @return id
     */
    public Long getId() {
        return id;
    }

    /**
     * 设置
     * @param id
     */
    public void setId(Long id) {
        this.id = id;
    }

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

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

    /**
     * 获取
     * @return leftPoints
     */
    public int getLeftPoints() {
        return leftPoints;
    }

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

    public String toString() {
        return "Member{id = " + id + ", name = " + name + ", leftPoints = " + leftPoints + "}";
    }
}
