<?php

namespace App\Support;

use App\Facades\Settings;
use Mtc\MercuryDataModels\Vehicle;

class FeedDescription
{
    /**
     * Resolve the description to send to sales-channel feed exports.
     *
     * When the "Use a separate description for feed exports" setting is enabled the vehicle's
     * dedicated feed description is used (even when blank); otherwise the standard description.
     */
    public static function for(Vehicle $vehicle): ?string
    {
        return Settings::get('sales-channels-feed-description-enabled', false)
            ? $vehicle->description_for_feeds
            : $vehicle->description;
    }
}
