"""
Python-PDI - Library for Personal Data Interchange.
Copyright (C) 2002-2003 Peter Gebauer

An example on how to create a new PDI file.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
versino 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
"""
from pdi.icalendar import ICalendar, VEvent
from pdi.core import UnknownProperty

def main():
    # Create a calendar and add some properties to it
    calendar = ICalendar()
    calendar.addProperties([UnknownProperty('PRODID', '1234-50'),
                            UnknownProperty('VERSION', '2.0'),
                            UnknownProperty('CALSCALE', 'GREGORIAN')
                            ])

    # Add an event to the calendar and add properties to the event
    event = calendar.addComponent(VEvent())
    event.addProperties([UnknownProperty('UID', '12837-64316346-346346-346'),
                         UnknownProperty('SUMMARY', 'Meeting with Ewing Oil.')
                         ])

    # Validate! Make sure we have everything we need.
    # We can skip the validation, though.
    calendar.validate()

    # Dump it!
    print(calendar)

if __name__ == '__main__':
    main()
