<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class UssdAnswer extends Model
{
    /**
     * @var array
     */
    protected $fillable = [
      'ussd_question_id',
        'answer',
        'answer_number',
        //if the question is not multiple choice, and the ussd service requires payment, store amount
        'amount', //and sms message on the question table. if the question has multiple choice and requires payment, store the
        ////amount and message on the this table
        'sms_message'
    ];

    /**
     * Ussd answer is related to a question
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function ussd_question() {
        return $this->belongsTo(UssdQuestion::class);
    }


    /**
     * Returns the answer with the numbering pre-pended ie 1. 2006
     * @return string
     */
    public function getAnswerWithNumber() {
        return $this->answer_number . ". " . $this->answer;
    }
}
