<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

use function PHPUnit\Framework\returnSelf;

class FondCommerce extends Model
{
    use HasFactory;

    public $fillable = [
        'activite',
        'surface_commerce',
        'chiffre_affaire_ht',
        'benefice_reconstitue',
        'total_commission',
        'bail_expiration',
        'categorie',
    ];

    protected $table = 'fond_commerces';

    public function bien(){
        return $this->hasOne(Bien::class);
    }

    public function categorie () {
        switch($this->categorie) {
            case 28:
                return "café, hotel, restaurant, tabac";
                break;
            case 29:
                return "Boulangerie, pâtisserie";
                break;
            case 30:
                return "Boucherie, charcuterie, poissonnerie, tout alimentaire";
                break;
            case 31:
                return "Parfumerie, coiffure, fleurs, équipement de la personne";
                break;
            case 32:
                return "Garage, station-service";
                break;
            case 33:
                return "Laverie, pressing, teinturerie";
                break;
            case 34:
                return "Pharmacie";
                break;
            case 35:
                return "autres activités, services";
                break;
            case 36:
                return "librairie, papeterie, tabac, presse";
                break;
        }
    }

    public function activite() {
        switch($this->activite){
            case 130:
                return "Café";
                break;
            case 131:
                return "Hôtel";
                break;
            case 132:
                return "Restaurant";
                break;
            case 133:
                return "Tabac";
                break;
            case 134:
                return "Presse";
                break;
            case 135:
                return "Boulangerie";
                break;
            case 136:
                return "Pâtisserie";
                break;
            case 137:
                return "Levure";
                break;
            case 138:
                return "Briocherie";
                break;
            case 139:
                return "Boucherie";
                break;
            case 140:
                return "Charcuterie";
                break;
            case 141:
                return "Poissonnerie";
                break;
            case 142:
                return "Tout alimentaire";
                break;
            case 143:
                return "Commerce de luxe";
                break;
            case 144:
                return "Equipement de la personne";
                break;
            case 145:
                return "Fleurs";
                break;
            case 146:
                return "Parfumerie";
                break;
            case 147:
                return "Salon de coiffure";
                break;
            case 148:
                return "Garage";
                break;
            case 149:
                return "Station-service";
                break;
            case 150:
                return "Laverie";
                break;
            case 151:
                return "Pressing";
                break;
            case 152:
                return "Teinturier";
                break;
            case 153:
                return "Pharmacie";
                break;
            case 154:
                return "Divers";
                break;
            case 155:
                return "Multiservice";
                break;
            case 156:
                return "Librairie";
                break;
            case 157:
                return "Papeterie";
                break;
                                                                                                
        }
    }
}
