package page.tools.xml;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public abstract class CompanyDetails {

    private String companyName;
    private String companyAddress1;
    private String companyAddress2;
    private String companyCityTown;
    private String companyCounty;
    private String companyPostCode;
    private String companyCountry;
    private String companyWebsite;
    
    private String authorFirstName;
    private String authorLastName;
    private String authorEmail;
    
    private String contactFirstName;
    private String contactLastName;
    private String contactEmail;
    
    private String salesEmail;
    private String salesPhone;
    
    private String supportEmail;
    private String supportPhone;
    
    private String generalEmail;
    private String generalPhone;
    
    private String fax;
    
    public Node getInfoNode(Document doc) {
        
        Element company = doc.createElement("Company_Info");
        
        Element companyName = doc.createElement("Company_Name");
        companyName.setTextContent(this.getCompanyName());
        Element companyAddress1 = doc.createElement("Address_1");
        companyAddress1.setTextContent(this.getCompanyAddress1());
        Element companyAddress2 = doc.createElement("Address_2");
        companyAddress2.setTextContent(this.getCompanyAddress2());            
        Element companyCityTown = doc.createElement("City_Town");
        companyCityTown.setTextContent(this.getCompanyCityTown());       
        Element companyCounty = doc.createElement("State_Province");
        companyCounty.setTextContent(this.getCompanyCounty());  
        Element companyPostCode = doc.createElement("Zip_Postal_Code");
        companyPostCode.setTextContent(this.getCompanyPostCode()); 
        Element companyCountry = doc.createElement("Country");
        companyCountry.setTextContent(this.getCompanyCountry());     
        Element companyWebsite = doc.createElement("Company_WebSite_URL");
        companyWebsite.setTextContent(this.getCompanyWebsite());    
        
        company.appendChild(companyName);
        company.appendChild(companyAddress1);
        company.appendChild(companyAddress2);
        company.appendChild(companyCityTown);
        company.appendChild(companyCounty);
        company.appendChild(companyPostCode);
        company.appendChild(companyCountry);
        company.appendChild(companyWebsite);
        
        Element contact = doc.createElement("Contact_Info");
        
        Element contactAuthorFirstName = doc.createElement("Author_First_Name");
        contactAuthorFirstName.setTextContent(this.getAuthorFirstName());
        Element contactAuthorLastName = doc.createElement("Author_Last_Name");
        contactAuthorLastName.setTextContent(this.getAuthorLastName());  
        Element contactAuthorEmail = doc.createElement("Author_Email");
        contactAuthorEmail.setTextContent(this.getAuthorEmail());
        
        Element contactFirstName = doc.createElement("Contact_First_Name");
        contactFirstName.setTextContent(this.getContactFirstName());
        Element contactLastName = doc.createElement("Contact_Last_Name");
        contactLastName.setTextContent(this.getContactLastName());  
        Element contactEmail = doc.createElement("Contact_Email");
        contactEmail.setTextContent(this.getContactEmail()); 
        
        contact.appendChild(contactAuthorFirstName);
        contact.appendChild(contactAuthorLastName);
        contact.appendChild(contactAuthorEmail);
        contact.appendChild(contactFirstName);
        contact.appendChild(contactLastName);
        contact.appendChild(contactEmail);    
        
        company.appendChild(contact);
        
        Element support = doc.createElement("Support_Info");
        
        Element supportSalesEmail = doc.createElement("Sales_Email");
        supportSalesEmail.setTextContent(this.getSalesEmail());
        Element supportEmail = doc.createElement("Support_Email");
        supportEmail.setTextContent(this.getSupportEmail());
        Element generalEmail = doc.createElement("General_Email");
        generalEmail.setTextContent(this.getGeneralEmail());
        Element supportSalesPhone = doc.createElement("Sales_Phone");
        supportSalesPhone.setTextContent(this.getSalesPhone());
        Element supportPhone = doc.createElement("Support_Phone");
        supportPhone.setTextContent(this.getSupportPhone());
        Element supportGeneralPhone = doc.createElement("General_Phone");
        supportGeneralPhone.setTextContent(this.getGeneralPhone());    
        Element supportFax = doc.createElement("Fax_Phone");
        supportFax.setTextContent(this.getFax());                 
       
        support.appendChild(supportSalesEmail);
        support.appendChild(supportEmail);
        support.appendChild(generalEmail);
        support.appendChild(supportSalesPhone);
        support.appendChild(supportPhone);
        support.appendChild(supportGeneralPhone);
        support.appendChild(supportFax);
        
        company.appendChild(support);
        
        return company;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getCompanyAddress1() {
        return companyAddress1;
    }

    public void setCompanyAddress1(String companyAddress1) {
        this.companyAddress1 = companyAddress1;
    }

    public String getCompanyAddress2() {
        return companyAddress2;
    }

    public void setCompanyAddress2(String companyAddress2) {
        this.companyAddress2 = companyAddress2;
    }

    public String getCompanyCityTown() {
        return companyCityTown;
    }

    public void setCompanyCityTown(String companyCityTown) {
        this.companyCityTown = companyCityTown;
    }

    public String getCompanyCounty() {
        return companyCounty;
    }

    public void setCompanyCounty(String companyCounty) {
        this.companyCounty = companyCounty;
    }

    public String getCompanyPostCode() {
        return companyPostCode;
    }

    public void setCompanyPostCode(String companyPostCode) {
        this.companyPostCode = companyPostCode;
    }

    public String getCompanyCountry() {
        return companyCountry;
    }

    public void setCompanyCountry(String companyCountry) {
        this.companyCountry = companyCountry;
    }

    public String getCompanyWebsite() {
        return companyWebsite;
    }

    public void setCompanyWebsite(String companyWebsite) {
        this.companyWebsite = companyWebsite;
    }

    public String getAuthorFirstName() {
        return authorFirstName;
    }

    public void setAuthorFirstName(String authorFirstName) {
        this.authorFirstName = authorFirstName;
    }

    public String getAuthorLastName() {
        return authorLastName;
    }

    public void setAuthorLastName(String authorLastName) {
        this.authorLastName = authorLastName;
    }

    public String getAuthorEmail() {
        return authorEmail;
    }

    public void setAuthorEmail(String authorEmail) {
        this.authorEmail = authorEmail;
    }

    public String getContactFirstName() {
        return contactFirstName;
    }

    public void setContactFirstName(String contactFirstName) {
        this.contactFirstName = contactFirstName;
    }

    public String getContactLastName() {
        return contactLastName;
    }

    public void setContactLastName(String contactLastName) {
        this.contactLastName = contactLastName;
    }

    public String getContactEmail() {
        return contactEmail;
    }

    public void setContactEmail(String contactEmail) {
        this.contactEmail = contactEmail;
    }

    public String getSalesEmail() {
        return salesEmail;
    }

    public void setSalesEmail(String salesEmail) {
        this.salesEmail = salesEmail;
    }

    public String getSalesPhone() {
        return salesPhone;
    }

    public void setSalesPhone(String salesPhone) {
        this.salesPhone = salesPhone;
    }

    public String getSupportEmail() {
        return supportEmail;
    }

    public void setSupportEmail(String supportEmail) {
        this.supportEmail = supportEmail;
    }

    public String getSupportPhone() {
        return supportPhone;
    }

    public void setSupportPhone(String supportPhone) {
        this.supportPhone = supportPhone;
    }

    public String getGeneralEmail() {
        return generalEmail;
    }

    public void setGeneralEmail(String generalEmail) {
        this.generalEmail = generalEmail;
    }

    public String getGeneralPhone() {
        return generalPhone;
    }

    public void setGeneralPhone(String generalPhone) {
        this.generalPhone = generalPhone;
    }

    public String getFax() {
        return fax;
    }

    public void setFax(String fax) {
        this.fax = fax;
    }
}

