package com.chengxusheji.po;

import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotEmpty;
import org.json.JSONException;
import org.json.JSONObject;

public class Customer {
    /*记录id*/
    private Integer customerId;
    public Integer getCustomerId(){
        return customerId;
    }
    public void setCustomerId(Integer customerId){
        this.customerId = customerId;
    }

    /*客户名称*/
    @NotEmpty(message="客户名称不能为空")
    private String customerName;
    public String getCustomerName() {
        return customerName;
    }
    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    /*客户类型*/
    @NotEmpty(message="客户类型不能为空")
    private String customerType;
    public String getCustomerType() {
        return customerType;
    }
    public void setCustomerType(String customerType) {
        this.customerType = customerType;
    }

    /*客户电话*/
    @NotEmpty(message="客户电话不能为空")
    private String telephone;
    public String getTelephone() {
        return telephone;
    }
    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    /*客户地址*/
    @NotEmpty(message="客户地址不能为空")
    private String customerAddress;
    public String getCustomerAddress() {
        return customerAddress;
    }
    public void setCustomerAddress(String customerAddress) {
        this.customerAddress = customerAddress;
    }

    /*客户备注*/
    private String memo;
    public String getMemo() {
        return memo;
    }
    public void setMemo(String memo) {
        this.memo = memo;
    }

    public JSONObject getJsonObject() throws JSONException {
    	JSONObject jsonCustomer=new JSONObject(); 
		jsonCustomer.accumulate("customerId", this.getCustomerId());
		jsonCustomer.accumulate("customerName", this.getCustomerName());
		jsonCustomer.accumulate("customerType", this.getCustomerType());
		jsonCustomer.accumulate("telephone", this.getTelephone());
		jsonCustomer.accumulate("customerAddress", this.getCustomerAddress());
		jsonCustomer.accumulate("memo", this.getMemo());
		return jsonCustomer;
    }}