<?php

namespace App\Models\Crm;

use App\Traits\BelongsToStore;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

class QuestionnaireTemplate extends Model
{
    use BelongsToStore;

    protected $fillable = [
        'store_id', 'title', 'description', 'questions', 'type', 'status',
    ];

    protected function casts(): array
    {
        return [
            'questions' => 'array',
            'type' => 'integer',
            'status' => 'integer',
        ];
    }

    public function answers(): HasMany
    {
        return $this->hasMany(QuestionnaireAnswer::class);
    }
}
