<?php
/**
 * Migration class for the 'employees_services' table.
 */

namespace RadiusTheme\RadiusBooking\Databases\Table;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
use RadiusTheme\RadiusBooking\Core\Database\Schema\Blueprint;
use RadiusTheme\RadiusBooking\Abstracts\Migration;
use RadiusTheme\RadiusBooking\Core\Database\Schema\Schema;
/**
 * Class EmployeesServicesTable
 *
 * @package RadiusTheme\RadiusBooking\Databases\Table
 * Migration for creating the 'employees_services' table.
 */
class EmployeesServicesTable extends Migration {
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up(): void {
		Schema::create(
			$this->tablePrefix . 'employees_services',
			function ( Blueprint $table ) {
				$table->id();
				$table->unsignedInteger( 'user_id' );
				$table->unsignedInteger( 'service_id' );
				$table->double( 'price' )->default( 0 );
				$table->unsignedInteger( 'min_capacity' )->default( 0 );
				$table->unsignedInteger( 'max_capacity' )->default( 0 );
				$table->json( 'custom_pricing' )->nullable();
				$table->timestamps();
			}
		);
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down(): void {
		Schema::drop( $this->tablePrefix . 'employees_services' );
	}
}
