package jp.agentec.sinaburocast.entity;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

@Entity
@Table(name="m_member")
public class Member extends AbstractEntity {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "member_id")
	public Integer memberId;

	@Column(name = "login_id")
	public String loginId;
	
	@Column(name = "password")
	public String password;

	@Column(name = "first_name")
	public String firstName;

	@Column(name = "last_name")
	public String lastName;

	@Column(name = "first_name_kana")
	public String firstNameKana;

	@Column(name = "last_name_kana")
	public String lastNameKana;

	@Column(name = "pc_email")
	public String pcEmail;

	@Column(name = "mb_email")
	public String mbEmail;

	@Column(name = "zip_code")
	public String zipCode;

	@Column(name = "prefecture_id")
	public Integer prefectureId;

	@Column(name = "city_name")
	public String cityName;

	@Column(name = "area_name")
	public String areaName;

	@Column(name = "building_name")
	public String buildingName;
	
	@Column(name = "telno")
	public String telno;

	@Column(name = "gender_cd")
	public Integer genderCd;

	@Column(name = "birthday")
	public String birthday;

	@Column(name = "valid_flg")
	public Integer validFlg;

	@Column(name = "point_num")
	public Integer pointNum;

	@Column(name = "auth_fail_num")
	public Integer authFailNum;

	@Temporal(TemporalType.DATE)
	@Column(name = "last_auth_date")
	public Timestamp lastAuthDate;

	@Column(name = "del_flg")
	public Integer delFlg;

	@Column(name = "memo")
	public String memo;

	@Column(name = "local_city_flg")
	public Integer localCityFlg;

	@OneToMany(mappedBy = "member")
	public List<MemberWithdraw> memberWithdrawList;

    @OneToOne
    @JoinColumn(name = "member_id", referencedColumnName = "member_id")
    public MemberWithdraw memberWithdraw;

	@OneToMany(mappedBy = "member")
	public List<PasswordMailSend> passwordMailSendList;

	@OneToMany(mappedBy = "member")
	public List<PointDonation> pointDonationList;

	@OneToMany(mappedBy = "member")
	public List<PointGet> pointGetList;

	@OneToMany(mappedBy = "member")
	public List<GiftExchange> giftExchangeList;

	@OneToMany(mappedBy = "member")
	public List<Reply> replyList;

    @ManyToOne
    @JoinColumn(name = "prefecture_id", referencedColumnName = "prefecture_id")
    public Prefecture prefecture;
    
    public transient boolean isNew;

    /** RDeliveryGroupMemberList関連プロパティ */
    @OneToMany(mappedBy = "member")
    public List<DeliveryGroupMember> deliveryGroupMemberList;
}