<?php

namespace App\Repositories\Shop;

use App\Models\Shop\CustomerSaleChannel;
use App\Traits\Model\Basic;

class CustomerSaleChannels
{
    use Basic;

    public static function createByCustomer($customerId)
    {
        $customer = Customers::get($customerId);

        return $customer->sale_channels()->sync(SaleChannels::getDefault());
    }

    public static function destroyByCustomerAndSaleChannel($customerId, $saleChannelId)
    {
        return CustomerSaleChannel::byCustomer($customerId)->bySaleChannel($saleChannelId)->delete();
    }

    public static function getModel()
    {
        return CustomerSaleChannel::query();
    }
}
