/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mobirent.datacollector;

import com.mobirent.abstracttags.DataClassable;
import com.mobirent.messageprocessor.XmlNode;

/**
 *
 * @author  Budai Attila
 */
public class Customer implements DataClassable {

    private String name;
    private String address;
    private String phone;

    public Customer(String name, String address, String phone) {
        this.name = name;
        this.address = address;
        this.phone = phone;
    }

    public Customer(XmlNode xmlNode) {
        XmlNode test;
        System.out.println("Customer node : " + xmlNode.toString());

        for (int i = 0; i < xmlNode.getSubNodes().size(); i++) {
            test = (XmlNode) xmlNode.getSubNodes().elementAt(i);
            if (test.getNodeName().equals("<p>")) {
                phone = test.getValue();
            } else if (test.getNodeName().equals("<a>")) {
                address = test.getValue();
            } else if (test.getNodeName().equals("<n>")) {
                name = test.getValue();

            }
        }
    }

    public String getAddress() {
        return "Cím: " + address;
    }

    public String getName() {
        return "Név: " + name;
    }

    public String getPhone() {
        return "Telefonszám: " + phone;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String toString() {
        return "Név : " + name + ", Cím: " + address + ", Telefonszám : " + phone;
    }

    public String reportIt() {
        return "";
    }
}
