#!/usr/bin/env ruby -w

require 'uml4ruby'

class Customer
    attr :name
    attr :address

    rettype String
    def creditRating() end
end

class Money
    umlhidden
end

class Product
end

class OrderLine
    tattr :quantity, Integer
    tattr :price, Money
    tattr :isSatisfied, Boolean
    association nil, :*, 1, Product
end

class Order
    attr :dateRecieved
    attr :isPrepaid
    tattr :number, String
    tattr :price, Money

    # Should really be :customer instead of nil first, but the diagram does
    # not contain it.
    association nil, :*, 1, Customer
    constraint 'if Order.customer.creditRating is "poor", then Order.isPrepaid must be true'
    association "line items", 1, :*, OrderLine

    def dispath() end
    def close() end
end

class Employee
end

class CorporateCustomer
    attr :contactName
    attr :creditRating
    attr :creditLimit

    association "sales rep", :*, "0..1", Employee

    def remind() end
    typesig Integer
    def billForMonth(i) end
end
