{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "title": "Tinder",
    "description": "This is not your tinder.",
    "generators": [
        {
            "ddl": {
                "rootPathPrefix": "db",
                "roleName": "tinder_role",
                "grants": [
                    "SELECT",
                    "INSERT",
                    "DELETE",
                    "UPDATE"
                ],
                "databaseName": "tinder_db",
                "schemaName": "tinder_schema"
            },
            "dockerfiles": {
                "CMDPath": "./bin/"
            }
        }
    ],
    "definitions": {
        "Config": {
            "type": "object",
            "title": "Config",
            "description": "Config represents the required options for this module to work",
            "definitions": {},
            "properties": {
                "Postgres": {
                    "type": "object",
                    "title": "Postgres",
                    "description": "Postgres holds the all credentials for postgres db connection.",
                    "properties": {
                        "Port": {
                            "description": "The port number for postgres config",
                            "type": "number",
                            "format": "int64",
                            "minimum": 1024
                        },
                        "Host": {
                            "description": "Host holds the hostname for the postgres",
                            "type": "string",
                            "minLength": 4,
                            "maxLength": 24
                        },
                        "Username": {
                            "description": "Username holds the username for the postgres",
                            "type": "string",
                            "minLength": 4,
                            "maxLength": 24
                        },
                        "Password": {
                            "description": "Password holds the password for the postgres",
                            "type": "string",
                            "minLength": 4,
                            "maxLength": 24
                        },
                        "DBName": {
                            "description": "DBName holds the database name for the postgres",
                            "type": "string",
                            "minLength": 4,
                            "maxLength": 24
                        }
                    },
                    "definitions": {}
                }
            }
        },
        "Profile": {
            "type": "object",
            "title": "Profile",
            "description": "Profile represents a registered Account's Public Info",
            "generators": [
                {
                    "ddl": {
                        "grants": [
                            "SELECT",
                            "INSERT",
                            "UPDATE"
                        ],
                        "primaryKey": [
                            "Id"
                        ]
                    }
                }
            ],
            "properties": {
                "Id": {
                    "description": "The unique identifier for a Account's Profile",
                    "type": "number",
                    "format": "int64",
                    "minimum": 1,
                    "propertyOrder": 10,
                    "tags": "json:\"_id,string\" bson:\"_id,string\""
                },
                "ScreenName": {
                    "description": "Full name associated with the profile. Maximum of 20 characters.",
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 20,
                    "propertyOrder": 20
                },
                "Location": {
                    "description": "The city or country describing where the user of the account is located. The contents are not normalized or geocoded in any way. Maximum of 30 characters.",
                    "type": "string",
                    "minLength": 0,
                    "maxLength": 30,
                    "propertyOrder": 30
                },
                "Description": {
                    "description": "A description of the user owning the account. Maximum of 160 characters.",
                    "type": "string",
                    "minLength": 0,
                    "maxLength": 160,
                    "propertyOrder": 40
                },
                "CreatedAt": {
                    "description": "Profile's creation time",
                    "type": "string",
                    "format": "date-time",
                    "default": "now()",
                    "propertyOrder": 50
                },
                "UpdatedAt": {
                    "description": "Profile's last update time",
                    "type": "string",
                    "format": "date-time",
                    "default": "now()",
                    "propertyOrder": 60
                },
                "DeletedAt": {
                    "description": "Profile's deletion time",
                    "type": "string",
                    "format": "date-time",
                    "propertyOrder": 70
                }
            },
            "required": [
                "ScreenName"
            ],
            "functions": {
                "One": {
                    "type": "object",
                    "description": "One returns the respective account with the given ID.",
                    "title": "One",
                    "properties": {
                        "incoming": {
                            "type": "number",
                            "format": "int64",
                            "minimum": 1
                        },
                        "outgoing": {
                            "$ref": "#/definitions/Profile"
                        }
                    }
                },
                "MarkAs": {
                    "type": "object",
                    "description": "MarkAs marks given account with given type constant, will be used mostly for marking as bot.",
                    "title": "One",
                    "properties": {
                        "incoming": {
                            "type": "object",
                            "title": "MarkAsRequest",
                            "properties": {
                                "Id": {
                                    "description": "The unique identifier for a Account's Profile",
                                    "type": "number",
                                    "format": "int64",
                                    "minimum": 1
                                },
                                "TypeConstant": {
                                    "type": "string"
                                }
                            }
                        },
                        "outgoing": {
                            "$ref": "#/definitions/Profile"
                        }
                    }
                },
                "Create": {
                    "type": "object",
                    "description": "Create creates a new profile on the system with given profile data.",
                    "title": "Create",
                    "properties": {
                        "incoming": {
                            "$ref": "#/definitions/Profile"
                        },
                        "outgoing": {
                            "$ref": "#/definitions/Profile"
                        }
                    }
                },
                "Update": {
                    "type": "object",
                    "description": "Update updates a new profile on the system with given profile data.",
                    "title": "One",
                    "properties": {
                        "incoming": {
                            "$ref": "#/definitions/Profile"
                        },
                        "outgoing": {
                            "$ref": "#/definitions/Profile"
                        }
                    }
                },
                "Delete": {
                    "type": "object",
                    "description": "Delete deletes the profile from the system with given profile id. Deletes are soft.",
                    "title": "One",
                    "properties": {
                        "incoming": {
                            "type": "number",
                            "format": "int64",
                            "minimum": 1
                        },
                        "outgoing": {
                            "$ref": "#/definitions/Profile"
                        }
                    }
                }
            }
        },
        "Account": {
            "type": "object",
            "title": "Account",
            "description": "Account represents a registered User",
            "generators": [
                {
                    "ddl": {
                        "grants": [
                            "SELECT",
                            "INSERT",
                            "UPDATE"
                        ],
                        "primaryKey": [
                            "Id"
                        ],
                        "uniqueKeys": [
                            [
                                "Id"
                            ],
                            [
                                "URL"
                            ]
                        ],
                        "foreignKeys": [
                            [
                                "ProfileID",
                                "Account.Profile.Id"
                            ]
                        ]
                    }
                }
            ],
            "properties": {
                "Id": {
                    "description": "The unique identifier for a Account",
                    "type": "number",
                    "format": "int64",
                    "minimum": 1,
                    "propertyOrder": 10
                },
                "ProfileID": {
                    "description": "The unique identifier for a Account's Profile",
                    "type": "number",
                    "format": "int64",
                    "minimum": 1,
                    "propertyOrder": 20
                },
                "FacebookID": {
                    "description": "Unique ID for facebook.com",
                    "type": "string",
                    "minLength": 1,
                    "propertyOrder": 30
                },
                "FacebookAccessToken": {
                    "description": "Access token for facebook.com",
                    "type": "string",
                    "minLength": 1,
                    "propertyOrder": 40
                },
                "FacebookSecretToken": {
                    "description": "Secret token for facebook.com",
                    "type": "string",
                    "minLength": 1,
                    "propertyOrder": 50
                },
                "EmailAddress": {
                    "description": "Email Address of the Account",
                    "type": "string",
                    "format": "email",
                    "propertyOrder": 60
                },
                "EmailStatusConstant": {
                    "description": "Status of the Account's Email",
                    "type": "string",
                    "enum": [
                        "verified",
                        "notVerified"
                    ],
                    "default": "notVerified",
                    "propertyOrder": 70
                },
                "StatusConstant": {
                    "description": "Status of the Account",
                    "type": "string",
                    "enum": [
                        "registered",
                        "disabled",
                        "spam"
                    ],
                    "default": "registered",
                    "propertyOrder": 80
                },
                "CreatedAt": {
                    "description": "Account's creation time",
                    "type": "string",
                    "format": "date-time",
                    "default": "now()",
                    "propertyOrder": 90
                },
                "UpdatedAt": {
                    "description": "Account's last update time",
                    "type": "string",
                    "format": "date-time",
                    "default": "now()",
                    "propertyOrder": 100
                },
                "DeletedAt": {
                    "description": "Account's deletion time",
                    "type": "string",
                    "format": "date-time",
                    "propertyOrder": 110
                }
            },
            "required": [
                "ProfileID",
                "FacebookID",
                "FacebookAccessToken",
                "FacebookSecretToken",
                "EmailAddress",
                "Password",
                "EmailStatusConstant"
            ],
            "functions": {
                "One": {
                    "type": "object",
                    "title": "One",
                    "description": "One fetches an Account from system by its ID",
                    "properties": {
                        "incoming": {
                            "type": "number",
                            "format": "int64",
                            "minimum": 1
                        },
                        "outgoing": {
                            "$ref": "#/definitions/Account"
                        }
                    }
                },
                "ByIDs": {
                    "type": "object",
                    "title": "ByIDs",
                    "description": "ByIDs fetches multiple Accounts from system by their IDs",
                    "properties": {
                        "incoming": {
                            "type": "array",
                            "items": [
                                {
                                    "type": "number",
                                    "format": "int64",
                                    "minimum": 1
                                }
                            ]
                        },
                        "outgoing": {
                            "type": "array",
                            "items": [
                                {
                                    "$ref": "#/definitions/Account"
                                }
                            ]
                        }
                    }
                },
                "ByFacebookIDs": {
                    "type": "object",
                    "title": "ByFacebookIDs",
                    "description": "ByFacebookIDs fetches multiple Accounts from system by their FacebookIDs",
                    "properties": {
                        "incoming": {
                            "type": "array",
                            "items": [
                                {
                                    "type": "string",
                                    "minLength": 1
                                }
                            ]
                        },
                        "outgoing": {
                            "type": "array",
                            "items": [
                                {
                                    "$ref": "#/definitions/Account"
                                }
                            ]
                        }
                    }
                },
                "Create": {
                    "type": "object",
                    "title": "One",
                    "description": "Create registers and account in the system by the given data",
                    "properties": {
                        "incoming": {
                            "$ref": "#/definitions/Account"
                        },
                        "outgoing": {
                            "$ref": "#/definitions/Account"
                        }
                    }
                },
                "Update": {
                    "type": "object",
                    "description": "Update updates the account on the system with given account data.",
                    "title": "One",
                    "properties": {
                        "incoming": {
                            "$ref": "#/definitions/Account"
                        },
                        "outgoing": {
                            "$ref": "#/definitions/Account"
                        }
                    }
                },
                "Delete": {
                    "type": "object",
                    "description": "Delete deletes the account from the system with given account id. Deletes are soft.",
                    "title": "One",
                    "properties": {
                        "incoming": {
                            "type": "number",
                            "format": "int64",
                            "minimum": 1
                        },
                        "outgoing": {
                            "$ref": "#/definitions/Account"
                        }
                    }
                }
            }
        },
        "FacebookProfile": {
            "type": "object",
            "title": "FacebookProfile",
            "description": "Holds Facebook Profiles",
            "generators": [
                {
                    "ddl": {
                        "roleName": "twitter_db_role",
                        "grants": [
                            "SELECT",
                            "INSERT",
                            "UPDATE"
                        ],
                        "primaryKey": [
                            "Id"
                        ]
                    }
                }
            ],
            "properties": {
                "Id": {
                    "description": "The unique identifier for a Facebook Profile",
                    "type": "string",
                    "propertyOrder": 10
                },
                "FirstName": {
                    "description": "First name for the Profile",
                    "type": "string",
                    "minLength": 1,
                    "propertyOrder": 20
                },
                "MiddleName": {
                    "description": "Middle name for the Profile. Optional",
                    "type": "string",
                    "propertyOrder": 30
                },
                "LastName": {
                    "description": "Last name for the Profile",
                    "type": "string",
                    "propertyOrder": 40
                },
                "PictureURL": {
                    "description": "Picture URL for the Profile",
                    "type": "string",
                    "propertyOrder": 50
                }
            },
            "required": [
                "Id"
            ],
            "functions": {
                "One": {
                    "type": "object",
                    "title": "One",
                    "description": "One fetches an FacebookProfile from system by its ID",
                    "properties": {
                        "incoming": {
                            "type": "number",
                            "format": "int64",
                            "minimum": 1
                        },
                        "outgoing": {
                            "$ref": "#/definitions/FacebookProfile"
                        }
                    }
                },
                "ByIDs": {
                    "type": "object",
                    "title": "ByIDs",
                    "description": "ByIDs fetches multiple FacebookProfile from system by their IDs",
                    "properties": {
                        "incoming": {
                            "type": "array",
                            "items": [
                                {
                                    "type": "string",
                                    "minimum": 1
                                }
                            ]
                        },
                        "outgoing": {
                            "type": "array",
                            "items": [
                                {
                                    "$ref": "#/definitions/FacebookProfile"
                                }
                            ]
                        }
                    }
                },
                "Create": {
                    "type": "object",
                    "title": "Create",
                    "description": "Create persists a FacebookProfile in the system",
                    "properties": {
                        "incoming": {
                            "$ref": "#/definitions/FacebookProfile"
                        },
                        "outgoing": {
                            "$ref": "#/definitions/FacebookProfile"
                        }
                    }
                },
                "Update": {
                    "type": "object",
                    "description": "Update updates the FacebookProfile on the system with given FacebookProfile data.",
                    "title": "One",
                    "properties": {
                        "incoming": {
                            "$ref": "#/definitions/FacebookProfile"
                        },
                        "outgoing": {
                            "$ref": "#/definitions/FacebookProfile"
                        }
                    }
                }
            }
        },
        "FacebookFriends": {
            "type": "object",
            "title": "FacebookFriends",
            "description": "Holds Facebook Friendship Status",
            "generators": [
                {
                    "ddl": {
                        "roleName": "twitter_db_role",
                        "grants": [
                            "SELECT",
                            "INSERT",
                            "DELETE"
                        ],
                        "primaryKey": [
                            "SourceId",
                            "TargetId"
                        ]
                    }
                }
            ],
            "properties": {
                "SourceId": {
                    "description": "The source unique identifier for a Facebook Profile, smaller one will be source.",
                    "type": "string",
                    "minLength": 1,
                    "propertyOrder": 10
                },
                "TargetId": {
                    "description": "The target unique identifier for a Facebook Profile, bigger one will be target.",
                    "type": "string",
                    "minLength": 1,
                    "propertyOrder": 20
                }
            },
            "required": [
                "SourceId",
                "TargetId"
            ],
            "functions": {
                "One": {
                    "type": "object",
                    "title": "One",
                    "description": "One fetches a FacebookFriends from system with FacebookFriends, will be used for validating the existance of the friendship",
                    "properties": {
                        "incoming": {
                            "$ref": "#/definitions/FacebookFriends"
                        },
                        "outgoing": {
                            "$ref": "#/definitions/FacebookFriends"
                        }
                    }
                },
                "Mutuals": {
                    "type": "object",
                    "description": "Mutuals return mutual friend's Facebook IDs between given source id and target id. Source and Target are inclusive.",
                    "title": "Mutuals",
                    "properties": {
                        "incoming": {
                            "type": "array",
                            "items": [
                                {
                                    "$ref": "#/definitions/FacebookFriends"
                                }
                            ]
                        },
                        "outgoing": {
                            "type": "array",
                            "items": [
                                {
                                    "type": "string",
                                    "minimum": 1
                                }
                            ]
                        }
                    }
                },
                "Create": {
                    "type": "object",
                    "description": "Create creates a relationship between two facebook account. This function is idempotent",
                    "title": "Create",
                    "properties": {
                        "incoming": {
                            "$ref": "#/definitions/FacebookFriends"
                        },
                        "outgoing": {
                            "$ref": "#/definitions/FacebookFriends"
                        }
                    }
                },
                "Delete": {
                    "type": "object",
                    "description": "Delete removes friendship.",
                    "title": "Delete",
                    "properties": {
                        "incoming": {
                            "$ref": "#/definitions/FacebookFriends"
                        },
                        "outgoing": {
                            "$ref": "#/definitions/FacebookFriends"
                        }
                    }
                }
            }
        }
    },
    "properties": {
        "Config": {
            "$ref": "#/definitions/Config"
        },
        "Profile": {
            "$ref": "#/definitions/Profile"
        },
        "Account": {
            "$ref": "#/definitions/Account"
        },
        "FacebookProfile": {
            "$ref": "#/definitions/FacebookProfile"
        },
        "FacebookFriends": {
            "$ref": "#/definitions/FacebookFriends"
        }
    },
    "required": [
        "Config",
        "Profile",
        "Account",
        "FacebookProfile",
        "FacebookFriends"
    ]
}