namespace ortund . Data

{

// Entity eliminates a lot of repetition by providing common property

// values through inheritance.

public class Entity

{

public int Id { get ; set ; }

public Company Company { get ; set ; }

}

// Each Company represents an organisation that will be using the system

// which employs this data model

public class Company

{

public int Id { get ; set ; }

public string Name { get ; set ; }

}

// Each User represents an employee of the Company to which it belongs

// who is authorized to use the system which employs this data model

public class User : Entity

{

public string EmailAddress { get ; set ; }

public string Password { get ; set ; }

}

// Every record in each of the following tables belongs to a company

// which represents a customer using the system.

// A Complex represents a location developed for high density housing

// that contains multiple apartments

public class Complex : Entity

{

public string Name { get ; set ; }

public Address Address { get ; set ; }

public Policy Policy { get ; set ; }

}

// An Apartment record represents housing inside a Complex

public class Apartment : Entity

{

public Complex Complex { get ; set ; }

public string Number { get ; set ; }

public Owner Owner { get ; set ; }

public Tenant Tenant { get ; set ; }

}

// An Owner record represents the owner of the apartment

public class Owner : Entity

{

public Apartment Apartment { get ; set ; }

public string AccountNumber { get ; set ; }

}

// A Tenant record represents the person who currently resides in

// the apartment

public class Tenant : Entity

{

public Apartment Apartment { get ; set ; }

public string AccountNumber { get ; set ; }

}

// An Address represents the physical location of a Complex

public class Address

{

public string [ ] Lines { get ; set ; }

public string Street { get ; set ; }

public string City { get ; set ; }

public string ZipCode { get ; set ; }

}

// A Policy represents the Insurance Policy under which all repairs

// are effected

public class Policy : Entity

{

public Insurer Insurer { get ; set ; }

public string Number { get ; set ; }

}

// An Insurer represents the Insurance company who provisioned the

// insurance policy

public class Insurer : Entity

{

public string Name { get ; set ; }

}

// Liaisons and LiaisonTypes don't exist under any particular company

// so select of these entities won't be limited to the company doing

// the selection.

// Not sure if this is ideal or absolutely to be avoided

// Liaisons represent the people who the Company can contact for any

// matter relating to the relevant LiaisonType (complex, owner, insurer, etc)

public class Liaison : Entity

{

public string Name { get ; set ; }

public string Phone { get ; set ; }

public string EmailAddress { get ; set ; }

public LiaisonType Type { get ; set ; } // required

public int TypeLink { get ; set ; } // required

public LiaisonType SubType { get ; set ; }

public int SubTypeLink { get ; set ; }

// A Type refers to any other object in the data model(complex, insurer, etc)

// TypeLink refers to the PK value of the particular object record to which

// this liaison belongs.

// This allows for multiple Liaisons per <entity>

}

// LiaisonType provides an updateable list of object types to be used in linking

// a Liaison to whatever other object in the data model it should be linked to.

public LiaisonType : Entity

{

public string Name { get ; set ; } // valid values are Complex, Insurer, etc

}