#pragma once

using namespace System;
using namespace System::Windows::Forms;

ref class Kunde
{
private:
        String^ vorname;
        String^ nachname;
        String^ id;
        EventHandler^ _IDChanged;

public:
        event EventHandler^ IDChanged
        {
        public:
           void add(EventHandler^ func) { _IDChanged += func; }
           void remove(EventHandler^ func) { _IDChanged -= func; }
           void raise(Object^ sender, EventArgs^ e) { if (_IDChanged) _IDChanged(sender, e); }
        }
        
public:
        Kunde(String^ vorname, String^ nachname, String^ id)
        {
            Vorname = vorname;
            Nachname = nachname;
            ID = id;
            _IDChanged = nullptr;
        }
        
        property String^ Vorname
        {
            String^ get() 
            { 
               return vorname; 
            }
            void set(String^ value) 
            { 
               vorname = value; 
            }
        }
        property String^ Nachname
        {
            String^ get() 
            { 
               return nachname; 
            }
            void set(String^ value) 
            { 
               nachname = value; 
            }
        }
        property String^ ID
        {
            String^ get() 
            { 
               return id; 
            }
            void set(String^ value) 
            { 
               id = value; 
               if (_IDChanged != nullptr)
                  IDChanged(this, gcnew EventArgs());
            }
        }
};
