class Response {
    constructor(data){
        this.code = 200
        this.msg = 'success'
        // this.data = data
    }
}

class SuccessResponse extends Response {
    constructor(data){
        super(data)
        this.data = data
    }
}

class ErrorResponse extends Response {
    constructor(data){
        super(data)
        if(typeof data === 'string'){
            this.code = 500
            this.msg = data
        }
        if (typeof data === 'object'){
            this.code = 500
            this.msg = "error"
            this.data = data
        }
        if (data === "" || data === null || data === undefined){
            this.code = 500
            this.msg = "error"
        }
    }
}

module.exports = {
    SuccessResponse,
    ErrorResponse
}