/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package model.company;

import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.OneToMany;
import model.AbstractEntity;
import model.adresses.CompanyBillingAddress;
import model.customer.Customer;
import model.ticket.Ticket;

/**
 *
 * @author patri
 */
@Entity
public class Company extends AbstractEntity {

    public static final String FIND_BY_NAME = "Company.findByName";
    public static final String FIND_BY_STEUERID = "Company.findBySteuerID";
    public static final String FIND_BY_UMSATZSTEUERID = "Company.findByUmsatzsteuerID";
    public static final String FIND_BY_CUSTOMER = "Company.findByCustomer";
    public static final String FIND_BY_ADDRESS = "Company.findByAddress";
    public static final String FIND_BY_DELIVERYADDRESS = "Company.findByLocation";

    @Column(unique = true, nullable = false)
    private String name;
    
    @Column(unique = true, nullable = true)
    private String steuerNr;
    
    @Column(unique = true, nullable = true)
    private String umsatzSteuerID;
    
    @Column(unique = true, nullable = true)
    private String kundenNr;
    
    @Column(unique = false, nullable = true)
    private String headerInspection;
    
    @Column(unique = false, nullable = true)
    private String headerService;
    
    @Column(unique = false, nullable = false)
    @Enumerated(EnumType.ORDINAL)
    private Status status;

    @OneToMany(mappedBy = "company", cascade = CascadeType.ALL)
    private Set<CompanyBillingAddress> addresses;

    @OneToMany(mappedBy = "company", cascade = CascadeType.ALL)
    private Set<Location> locations;
    
    @OneToMany(mappedBy = "company", cascade = {
        CascadeType.MERGE,
        CascadeType.REFRESH
    })
    private Set<Customer> customers;
    
    @OneToMany(mappedBy = "company")
    private List<Ticket> tickets;
    
    public Company() {
    }

    public String getName() {
        return name;
    }

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

    public String getSteuerNr() {
        return steuerNr;
    }

    public void setSteuerNr(String steuerNr) {
        this.steuerNr = steuerNr;
    }

    public String getUmsatzSteuerID() {
        return umsatzSteuerID;
    }

    public void setUmsatzSteuerID(String umsatzSteuerID) {
        this.umsatzSteuerID = umsatzSteuerID;
    }

    public String getKundenNr() {
        return kundenNr;
    }

    public void setKundenNr(String kundenNr) {
        this.kundenNr = kundenNr;
    }

    public String getHeaderInspection() {
        return headerInspection;
    }

    public void setHeaderInspection(String headerInspection) {
        this.headerInspection = headerInspection;
    }

    public String getHeaderService() {
        return headerService;
    }

    public void setHeaderService(String headerService) {
        this.headerService = headerService;
    }

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    public Set<CompanyBillingAddress> getAddresses() {
        return addresses;
    }

    public void setAddresses(Set<CompanyBillingAddress> addresses) {
        this.addresses = addresses;
    }

    public Set<Location> getLocations() {
        return locations;
    }

    public void setLocations(Set<Location> locations) {
        this.locations = locations;
    }

    public Set<Customer> getCustomers() {
        return customers;
    }

    public void setCustomers(Set<Customer> customers) {
        this.customers = customers;
    }

    public List<Ticket> getTickets() {
        return tickets;
    }

    public void setTickets(List<Ticket> tickets) {
        this.tickets = tickets;
    }
}
