import models/SimpleClassDiagrams as SimpleClassDiagrams
include "primitives.alh"

SimpleClassDiagrams CoreFormalism {
    SimpleAttribute String {
        name = "String"
    }

    SimpleAttribute Permissions {
        name = "Permissions"
    }

    SimpleAttribute Boolean {
        name = "Boolean"
    }

    SimpleAttribute Natural {
        name = "Natural"
    }

    Class User {
        name = "User"
        name : String
        password : String
        admin : Boolean
    }

    Class Group {
        name = "Group"
        name : String
    }

    Association ownedBy (Group, User) {
        name = "ownedBy"
    }
    Association belongsTo (User, Group) {
        name = "belongsTo"
    }

    Class Entry {
        name = "Entry"
        name : String
        permissions : Permissions
    }

    Class Folder : Entry {
        name = "Folder"
    }

    Association contains (Folder, Entry) {
        name = "contains"
    }

    Class Model : Entry {
        name = "Model"
        location : String
    }

    Class TypeMapping : Model {
        name = "TypeMapping"
    }

    Association instanceOf (Model, Model) {
        name = "instanceOf"
    }

    Association owner (Model, User) {
        name = "owner"
        target_lower_cardinality = 1
        target_upper_cardinality = 1
    }

    Association group (Model, Group) {
        name = "group"
        target_lower_cardinality = 1
        target_upper_cardinality = 1
    }

    Class Transformation : Model {
        name = "Transformation"
    }

    Class ModelTransformation : Transformation {
        name = "ModelTransformation"
    }

    Class ActionLanguage : Transformation {
        name = "ActionLanguage"
    }

    Class ManualOperation : Transformation {
        name = "ManualOperation"
    }

    Association transformInput (Model, Transformation) {
        name = "transformInput"
        name : String
    }

    Association transformOutput (Transformation, Model) {
        name = "transformOutput"
        name : String
    }

    Association tracability (Model, Model) {
        name = "tracability"
        type : String
    }

    Association typing (instanceOf, TypeMapping) {
        name = "typing"
        target_lower_cardinality = 1
        target_upper_cardinality = 1
    }

    Class Service {
        name = "Service"
        name : String
        port : String
    }
}

export CoreFormalism to models/CoreFormalism
