N = Default
M = Default
P = 8001

###############
# Server, NPM #
###############
.PHONY: all
all:
	php artisan serve

.PHONY: port
port:
	php artisan serve --port=$(P)

.PHONY: build
build:
	npm --prefix Modules/$(M) run build

.PHONY: build-frontend
build-frontend:
	npm --prefix Modules/Frontend run build
	copy 

.PHONY: watch
watch:
	npm --prefix Modules/$(M) run watch

############################
# Default Laravel Commands #
############################
.PHONY: storage
storage:
	php artisan storage:link

.PHONY: clear
clear:
	php artisan optimize:clear

.PHONY: middleware
middleware:
	php artisan make:middleware $(N)

.PHONY: excel-export
excel-export:
	php artisan make:export $(N)Export

.PHONY: excel-import
excel-import:
	php artisan make:import $(N)Import

.PHONY: jwt
jwt:
	php artisan jwt:secret

.PHONY: swagger
swagger:
	php artisan l5-swagger:generate

###################
# Module Commands #
###################
.PHONY: module
module:
	php artisan module:make $(M)

.PHONY: controller
controller:
	php artisan module:make-controller $(N)Controller $(M)

.PHONY: model
model:
	php artisan module:make-model $(N) $(M)

.PHONY: table
table:
	php artisan module:make-migration create_$(N)_table $(M)

.PHONY: migrate
migrate:
	php artisan module:migrate $(M)

.PHONY: migrate-refresh
migrate-refresh:
	php artisan module:migrate-refresh $(M)

.PHONY: migrate-reset
migrate-reset:
	php artisan module:migrate-reset $(M)

.PHONY: make-seed
make-seed:
	php artisan module:make-seed $(N)Seeder $(M)

.PHONY: seed
seed:
	php artisan module:seed $(M)

.PHONY: email
email:
	php artisan module:make-mail $(N)Email $(M)

.PHONY: livewire
livewire:
	php artisan module:make-livewire $(N) $(M)

.PHONY: component
component:
	php artisan module:make-component $(N) $(M)

####################
# Publish Frontend #
####################
.PHONY: public-front
public-front:
	php artisan module:publish Frontend

#######
# Git #
#######
.PHONY: git-oneline
git-oneline:
	git log --graph --decorate --pretty=oneline --abbrev-commit



#################
# Playwright Test #
#################
.PHONY: playwright-test
playwright-test:
	npm run test

.PHONY: playwright-test-watch
playwright-test-watch:
	npm run test:watch

.PHONY: playwright-test-update-snapshots
playwright-test-update-snapshots:
	npm run test:update-snapshots

.PHONY: playwright-test-report
playwright-test-report:
	npm run test:report

.PHONY: playwright-test-codegen
playwright-test-codegen:
	npm run test:codegen

.PHONY: playwright-test-ui
playwright-test-ui:
	npm run test:ui

.PHONY: playwright-test-headed
playwright-test-headed:
	npm run test:headed



npx playwright test tests/Tag/admin-tag.spec.ts --headed

npx playwright test tests/Contact/ --reporter=line

# show report 
npx playwright show-report

	