<?php
/**
 * Migration class for the 'locations' 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 LocationsTable
 *
 * @package RadiusTheme\RadiusBooking\Databases\Table
 * Migration for creating the 'locations' table.
 */
class LocationsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up(): void {
		Schema::create(
			$this->tablePrefix . 'locations',
			function ( Blueprint $table ) {
				$table->id();
				$table->string( 'name' );
				$table->longText( 'description' )->nullable();
				$table->longText( 'address' );
				$table->decimal( 'latitude' )->nullable();
				$table->decimal( 'longitude' )->nullable();
				$table->string( 'phone' )->nullable();
				$table->bigInteger( 'image_id' )->nullable();
				$table->string( 'status' )->default( 'active' );
				$table->json( 'translations' )->nullable()->default( null );
				$table->timestamps();
			}
		);
	}

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