-- Compiled with roblox-ts v1.2.7

local TS = require(game:GetService("ReplicatedStorage"):WaitForChild("Vendor"):WaitForChild("RuntimeLib"))
local Maid = TS.import(script, TS.getModule(script, "@rbxts", "maid").Maid)
local _services = TS.import(script, TS.getModule(script, "@rbxts", "services"))
local HttpService = _services.HttpService
local PhysicsService = _services.PhysicsService
local Workspace = _services.Workspace
local getNearestPart = TS.import(script, game:GetService("ReplicatedStorage"), "Common", "helpers", "common").getNearestPart
local CustomerAnimations = TS.import(script, game:GetService("ServerScriptService"), "customers", "components", "animations").CustomerAnimations
local CustomerAppearance = TS.import(script, game:GetService("ServerScriptService"), "customers", "components", "appearance").CustomerAppearance
local CustomerMovement = TS.import(script, game:GetService("ServerScriptService"), "customers", "components", "movement").CustomerMovement
local waypoints = TS.import(script, game:GetService("ServerScriptService"), "customers", "components", "movement", "waypoints").waypoints
local Customer
do
	Customer = setmetatable({}, {
		__tostring = function()
			return "Customer"
		end,
	})
	Customer.__index = Customer
	function Customer.new(...)
		local self = setmetatable({}, Customer)
		return self:constructor(...) or self
	end
	function Customer:constructor(config)
		self.config = config
		self.id = HttpService:GenerateGUID(false)
		self.appearance = CustomerAppearance.new(self)
		self.model = self.appearance:GetModel()
		self.rootPart = self.model:WaitForChild("HumanoidRootPart")
		self.humanoid = self.model:WaitForChild("Humanoid")
		self.movement = CustomerMovement.new(self)
		self.animations = CustomerAnimations.new(self)
		self.maid = Maid.new()
		self.maid:GiveTask(self.model)
		self.maid:GiveTask(self.movement)
		self.maid:GiveTask(self.animations)
	end
	function Customer:Spawn()
		local position = waypoints.Spawn[math.random(#waypoints.Spawn) - 1 + 1].Position
		local spawnOffset = Vector3.new(0, self.humanoid.HipHeight + 3, 0)
		local spawnPosition = position + spawnOffset
		local _exp = self.model:GetDescendants()
		local _arg0 = function(desc)
			if desc:IsA("BasePart") then
				PhysicsService:SetPartCollisionGroup(desc, "Customers")
			end
		end
		-- ▼ ReadonlyArray.forEach ▼
		for _k, _v in ipairs(_exp) do
			_arg0(_v, _k - 1, _exp)
		end
		-- ▲ ReadonlyArray.forEach ▲
		self.spawnOffset = spawnOffset
		self.model.Parent = Workspace
		self.model:PivotTo(CFrame.new(spawnPosition))
		self:Log("Spawned")
	end
	function Customer:MoveTo(target, floorId)
		self.humanoid.Sit = false
		if type(target) == "string" then
			local _fn = self.movement
			local _condition = floorId
			if not (_condition ~= 0 and (_condition == _condition and (_condition ~= "" and _condition))) then
				_condition = self.config.floorId
			end
			_fn:MoveToWaypoint(target, _condition)
		else
			self.movement:MoveTo(target)
		end
	end
	function Customer:Sit(seat)
		if not seat then
			seat = getNearestPart(waypoints.Seat, self.rootPart.Position)
		end
		seat:Sit(self.humanoid)
	end
	function Customer:Destroy()
		self.maid:Destroy()
	end
	function Customer:Log(...)
		local messages = { ... }
	end
end
return {
	Customer = Customer,
}
