<?php

namespace App\Models\Service;

use App\Models\SupplierHostServer;
use App\Traits\ServiceDomains;

/**
 * Class Host (Service)
 * Services that are Web Hosting
 */
class Host extends Type
{
	use ServiceDomains;

	protected $table = 'service_host';
	protected $with = ['tld'];

	/* RELATIONS */

	public function provider()
	{
		return $this->belongsTo(SupplierHostServer::class,'supplier_host_server_id');
	}

	/* OVERRIDES */

	/**
	 * Service update validation
	 *
	 * @return array
	 */
	public function validation(): array
	{
		return [
			'domain_name' => 'nullable|string|min:2',
			'tld_id' => 'required|exists:tlds,id',
			'expire_at' => 'required|date',
			'supplier_host_server_id' => 'required|exists:supplier_host_servers,id',
			'host_username' => 'nullable|string',
			'host_password' => 'nullable|string',
		];
	}
}