{
    "openapi": "3.0.0",
    "info": {
        "version": "1.0.0",
        "title": "Serviço de notificação Push",
        "description": "API para envio de notificações push para dispositivos Android e iOS, é utilizado por aplicações com o Convert Omnichannel"
    },
    "servers": [
        {
            "url": "https://push1.convert.app.br/api/v1"
        }
    ],
    "paths": {
        "/notify": {
            "post": {
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "summary": "Enviar uma notificação",
                "tags": [
                    "Notificar"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "type",
                                    "device",
                                    "token_device",
                                    "data"
                                ],
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "example": "omnichannel",
                                        "description": "Tipo de notificação",
                                        "enum": [
                                            "omnichannel",
                                            "touch"
                                        ]
                                    },
                                    "device": {
                                        "type": "string",
                                        "example": "android",
                                        "description": "Identificador do dispositivo do contato",
                                        "enum": [
                                            "android",
                                            "ios"
                                        ]
                                    },
                                    "token_device": {
                                        "type": "string",
                                        "example": "abcdabcdaccbbcbcbcbcbcbcbcb",
                                        "description": "Token do dispositivo do contato"
                                    },
                                    "data": {
                                        "type": "object",
                                        "required": [
                                            "title"
                                        ],
                                        "properties": {
                                            "title": {
                                                "type": "string",
                                                "example": "Notificação OmniChannel",
                                                "description": "Título da Notificação"
                                            },
                                            "message": {
                                                "type": "string",
                                                "example": "Olá fulano",
                                                "description": "Mensagem (obs.: utilizar somente quando device = android)"
                                            },
                                            "body": {
                                                "type": "string",
                                                "example": "Olá fulano",
                                                "description": "Mensagem (obs.: utilizar somente quando device = ios)"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Resposta em caso de sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "description": {
                                            "type": "string",
                                            "example": "Push posicionado para envio"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Falha ao enviar notificação push",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "description": {
                                            "type": "string",
                                            "example": "Type não foi informado. (omnichannel)"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/sendMail": {
            "post": {
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "summary": "Enviar um e-mail",
                "tags": [
                    "Envio de E-mail"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "subject",
                                    "body",
                                    "from",
                                    "to"
                                ],
                                "properties": {
                                    "subject": {
                                        "type": "string",
                                        "example": "Lembrete de reunião",
                                        "description": "Assunto"
                                    },
                                    "body": {
                                        "type": "string",
                                        "example": "Olá Gabriel, teremos reunião na próxima quarta-feira, às 14:30, te aguardamos lá.",
                                        "description": "Corpo do e-mail"
                                    },
                                    "from": {
                                        "type": "string",
                                        "example": "diego@convertcompany.com.br",
                                        "description": "Remetente"
                                    },
                                    "to": {
                                        "type": "string",
                                        "example": "gabriel@convertcompany.com.br",
                                        "description": "Destinatário"
                                    },
                                    "cc": {
                                        "type": "string",
                                        "example": "bruno@convertcompany.com.br",
                                        "description": "Cópia"
                                    },
                                    "bcc": {
                                        "type": "string",
                                        "example": "brunohl@convertcompany.com.br",
                                        "description": "Cópia Oculta"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Resposta em caso de sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "statusCode": {
                                            "type": "integer",
                                            "example": 200
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "E-mail enviado com sucesso!"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Falha ao enviar o e-mail",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "statusCode": {
                                            "type": "integer",
                                            "example": 500
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string",
                                            "example": "Ocorreu uma falha ao enviar o e-mail."
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}