{
    "swagger": "2.0",
    "info": {
        "title": "Registry Console API",
        "version": "1.0.0"
    },
    "schemes": [
        "https"
    ],
    "consumes": [
        "application/json"
    ],
    "produces": [
        "application/json"
    ],
    "paths": {
        "/console-api/user": {
            "get": {
                "summary": "Provides user type to UI",
                "responses": {
                    "200": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "type": {
                                    "type": "string",
                                    "enum":[
                                        "ADMIN",
                                        "USER"
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        "/console-api/poll": {
            "post": {
                "summary": "Every T minutes (1?) request/response to keep front-end in sync with the back-end",
                "parameters": [{
                    "name": "version",
                    "in": "body",
                    "required": true,
                    "type": "string",
                    "format": "string"
                }, {
                    "name": "registrarId",
                    "in": "body",
                    "required": false,
                    "type": "string",
                    "format": "string"
                }, {
                    "name": "notificationId",
                    "in": "body",
                    "required": false,
                    "type": "string",
                    "format": "string"
                }],
                "responses": {
                    "200": {
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "notificationText": {
                                        "type": "string"
                                    },
                                    "notificationId": {
                                        "type": "string"
                                    },
                                    "dismissable": {
                                        "type": "boolean"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/console-api/registrars": {
            "get": {
                "summary": "Provides list of available registrars to UI",
                "responses": {
                    "200": {
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string"
                                    },
                                    "registrarId": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/console-api/domains": {
            "get": {
                "summary": "GET list of domains per registrar with pagination and filters",
                "parameters": [{
                    "name": "registrarId",
                    "in": "query",
                    "required": false,
                    "type": "string",
                    "format": "string"
                }, {
                    "name": "limit",
                    "in": "query",
                    "required": false,
                    "type": "number",
                    "default": 10
                }, {
                    "name": "marker",
                    "description": "Name of the last domain retrieved by the user",
                    "in": "query",
                    "required": false,
                    "type": "string"
                }, {
                    "name": "filterBy",
                    "in": "query",
                    "required": false,
                    "content": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "name": {
                                    "type": "string"
                                },
                                "tld": {
                                    "type":"array",
                                    "items": {
                                        "type":"string"
                                    }
                                },
                                "status":{
                                    "type":"array",
                                    "items": {
                                        "type":"string"
                                    }
                                },
                                "isLocked": {
                                    "type": "boolean"
                                }
                            }
                        }
                    }
                }],
                "responses": {
                    "200": {
                        "description": "Provides list of domains per registrar",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string"
                                    },
                                    "tld": {
                                        "type": "string"
                                    },
                                    "status": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "enum":[
                                                "CLIENT_DELETE_PROHIBITED",
                                                "CLIENT_HOLD",
                                                "CLIENT_RENEW_PROHIBITED",
                                                "CLIENT_TRANSFER_PROHIBITED",
                                                "CLIENT_UPDATE_PROHIBITED",
                                                "INACTIVE",
                                                "LINKED",
                                                "OK",
                                                "PENDING_CREATE",
                                                "PENDING_DELETE",
                                                "PENDING_TRANSFER",
                                                "PENDING_UPDATE",
                                                "SERVER_DELETE_PROHIBITED",
                                                "SERVER_HOLD",
                                                "SERVER_RENEW_PROHIBITED",
                                                "SERVER_TRANSFER_PROHIBITED",
                                                "SERVER_UPDATE_PROHIBITED"
                                            ]
                                        }
                                    },
                                    "isLocked": {
                                        "type": "boolean"
                                    },
                                    "creationTime": {
                                        "type": "string"
                                    },
                                    "expirationTime": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/console-api/domain": {
            "post": {
                "summary": "Apply action on a domain",
                "responses": {
                    "200": {
                        "description": "Action has been succesfully applied"
                    }
                },
                "parameters": [
                    {
                        "name": "domain",
                        "in": "path",
                        "required": true,
                        "type": "string",
                        "format": "string"
                    },
                    {
                        "name": "registrarId",
                        "in": "body",
                        "required": false,
                        "type": "string",
                        "format": "string"
                    },
                    {
                        "name": "action",
                        "in": "body",
                        "required": true,
                        "type": "string",
                        "format": "string"
                    }
                ]
            }
        },
        "/console-api/settings/contacts/get": {
            "get": {
                "summary": "GET settings contact page",
                "responses": {
                    "200": {
                        "description": "Provides list of contacts per registrar",
                        "schema": {
                            "$ref": "#/definitions/settingsContacts"
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "registrarId",
                        "in": "query",
                        "required": false,
                        "type": "string",
                        "format": "string"
                    }
                ]
            }
        },
        "/console-api/settings/contacts/upd": {
            "post": {
                "summary": "Creates, updates or delete registrar contacts",
                "responses": {
                    "200": {
                        "schema": {
                            "$ref": "#/definitions/settingsContacts"
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "registrarId",
                        "in": "body",
                        "required": false,
                        "type": "string",
                        "format": "string"
                    },
                    {
                        "name": "contacts",
                        "in": "body",
                        "required": true,
                        "type": "array",
                        "schema": {
                            "$ref": "#/definitions/settingsContacts"
                        }
                    }
                ]
            }
        }
    },

    "definitions": {
        "settingsContacts": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "emailAddress": {
                        "type": "string"
                    },
                    "registrarId": {
                        "type": "string"
                    },
                    "registryLockEmailAddress": {
                        "type": "string"
                    },
                    "phoneNumber": {
                        "type": "string"
                    },
                    "faxNumber": {
                        "type": "string"
                    },
                    "types": {
                        "type": "string",
                        "enum": [
                            "ABUSE",
                            "ADMIN",
                            "BILLING",
                            "LEGAL",
                            "MARKETING",
                            "TECH",
                            "WHOIS"
                        ]
                    },
                    "visibleInWhoisAsAdmin": {
                        "type": "boolean"
                    },
                    "visibleInWhoisAsTech": {
                        "type": "boolean"
                    },
                    "visibleInDomainWhoisAsAbuse": {
                        "type": "boolean"
                    },
                    "allowedToSetRegistryLockPassword": {
                        "type": "boolean"
                    }
                }
            }
        }
    }
}