package entity

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestCamera_CameraType(t *testing.T) {
	t.Run("Unknown", func(t *testing.T) {
		camera := NewCamera("", "")
		assert.Equal(t, CameraTypeUnknown, camera.CameraType)
		assert.Equal(t, ModelUnknown, camera.CameraName)
		assert.Equal(t, MakeNone, camera.CameraMake)
		assert.Equal(t, ModelUnknown, camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("Foo", func(t *testing.T) {
		camera := NewCamera("foo", "")
		assert.Equal(t, CameraTypeUnknown, camera.CameraType)
		assert.Equal(t, "foo", camera.CameraMake)
		assert.Equal(t, ModelNone, camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("CanonEOS6D", func(t *testing.T) {
		camera := NewCamera(MakeCanon, "EOS 6D")
		assert.Equal(t, CameraTypeBody, camera.CameraType)
		assert.Equal(t, MakeCanon+" EOS 6D", camera.CameraName)
		assert.Equal(t, MakeCanon, camera.CameraMake)
		assert.Equal(t, "EOS 6D", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("Hasselblad", func(t *testing.T) {
		camera := NewCamera(MakeHasselblad, "L2D-20c")
		assert.Equal(t, CameraTypeBody, camera.CameraType)
		assert.Equal(t, MakeHasselblad, camera.CameraMake)
		assert.Equal(t, "L2D-20c", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("IPhone", func(t *testing.T) {
		camera := NewCamera(MakeApple, ModelIPhone)
		assert.Equal(t, CameraTypePhone, camera.CameraType)
		assert.Equal(t, MakeApple+" "+ModelIPhone, camera.CameraName)
		assert.Equal(t, MakeApple, camera.CameraMake)
		assert.Equal(t, ModelIPhone, camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("IPad", func(t *testing.T) {
		camera := NewCamera(MakeApple, ModelIPad)
		assert.Equal(t, CameraTypeTablet, camera.CameraType)
		assert.Equal(t, MakeApple+" "+ModelIPad, camera.CameraName)
		assert.Equal(t, MakeApple, camera.CameraMake)
		assert.Equal(t, ModelIPad, camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("IPadAir", func(t *testing.T) {
		camera := NewCamera(MakeApple, ModelIPadAir)
		assert.Equal(t, CameraTypeTablet, camera.CameraType)
		assert.Equal(t, MakeApple, camera.CameraMake)
		assert.Equal(t, ModelIPadAir, camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("IPadPro", func(t *testing.T) {
		camera := NewCamera(MakeApple, ModelIPadPro)
		assert.Equal(t, CameraTypeTablet, camera.CameraType)
		assert.Equal(t, MakeApple, camera.CameraMake)
		assert.Equal(t, ModelIPadPro, camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("GooglePixelTablet", func(t *testing.T) {
		camera := NewCamera(MakeGoogle, "Pixel Tablet")
		assert.Equal(t, CameraTypeTablet, camera.CameraType)
		assert.Equal(t, MakeGoogle, camera.CameraMake)
		assert.Equal(t, "Pixel Tablet", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("GooglePixelSlate", func(t *testing.T) {
		camera := NewCamera(MakeGoogle, "Pixel Slate")
		assert.Equal(t, CameraTypeTablet, camera.CameraType)
		assert.Equal(t, MakeGoogle, camera.CameraMake)
		assert.Equal(t, "Pixel Slate", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("GooglePixel8a", func(t *testing.T) {
		camera := NewCamera(MakeGoogle, "Pixel 8a")
		assert.Equal(t, CameraTypePhone, camera.CameraType)
		assert.Equal(t, MakeGoogle, camera.CameraMake)
		assert.Equal(t, "Pixel 8a", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("HuaweiP30", func(t *testing.T) {
		camera := NewCamera(MakeHuawei, "P30")
		assert.Equal(t, CameraTypePhone, camera.CameraType)
		assert.Equal(t, MakeHuawei, camera.CameraMake)
		assert.Equal(t, "P30", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("HuaweiMate20lite", func(t *testing.T) {
		camera := NewCamera(MakeHuawei, "INE-LX2")
		assert.Equal(t, CameraTypePhone, camera.CameraType)
		assert.Equal(t, MakeHuawei, camera.CameraMake)
		assert.Equal(t, "Mate 20 lite", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("HuaweiMatePadPro", func(t *testing.T) {
		camera := NewCamera(MakeHuawei, "MatePad Pro")
		assert.Equal(t, CameraTypeTablet, camera.CameraType)
		assert.Equal(t, MakeHuawei, camera.CameraMake)
		assert.Equal(t, "MatePad Pro", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("XiaomiRedmiPad", func(t *testing.T) {
		camera := NewCamera("XIAOMI", "Redmi Pad SE 8.7")
		assert.Equal(t, CameraTypeTablet, camera.CameraType)
		assert.Equal(t, MakeXiaomi, camera.CameraMake)
		assert.Equal(t, "Redmi Pad SE 8.7", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("SamsungGalaxyS21", func(t *testing.T) {
		camera := NewCamera(MakeSamsung, "Galaxy S21")
		assert.Equal(t, CameraTypePhone, camera.CameraType)
		assert.Equal(t, MakeSamsung, camera.CameraMake)
		assert.Equal(t, "Galaxy S21", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("Motorola", func(t *testing.T) {
		camera := NewCamera(MakeMotorola, "")
		assert.Equal(t, CameraTypePhone, camera.CameraType)
		assert.Equal(t, MakeMotorola, camera.CameraMake)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("GoPro", func(t *testing.T) {
		camera := NewCamera(MakeGoPro, "")
		assert.Equal(t, CameraTypeAction, camera.CameraType)
		assert.Equal(t, MakeGoPro, camera.CameraMake)
		assert.False(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("RaspberryPi", func(t *testing.T) {
		camera := NewCamera(MakeRaspberryPi, "")
		assert.Equal(t, CameraTypeComputer, camera.CameraType)
		assert.Equal(t, MakeRaspberryPi, camera.CameraMake)
		assert.False(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("Ricoh", func(t *testing.T) {
		camera := NewCamera(MakeRicoh, "")
		assert.Equal(t, CameraTypeCompact, camera.CameraType)
		assert.Equal(t, MakeRicoh, camera.CameraMake)
		assert.False(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("Reolink", func(t *testing.T) {
		camera := NewCamera(MakeReolink, "")
		assert.Equal(t, CameraTypeSurveillance, camera.CameraType)
		assert.Equal(t, MakeReolink, camera.CameraMake)
		assert.False(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("SamsungGalaxyTab", func(t *testing.T) {
		camera := NewCamera(MakeSamsung, "Galaxy Tab")
		assert.Equal(t, MakeSamsung+" Galaxy Tab", camera.CameraName)
		assert.Equal(t, CameraTypeTablet, camera.CameraType)
		assert.Equal(t, MakeSamsung, camera.CameraMake)
		assert.Equal(t, "Galaxy Tab", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("PolaroidOne600Nero", func(t *testing.T) {
		camera := NewCamera(MakePolaroid, "One600 Nero")
		assert.Equal(t, MakePolaroid+" One600 Nero", camera.CameraName)
		assert.Equal(t, CameraTypeInstant, camera.CameraType)
		assert.Equal(t, MakePolaroid, camera.CameraMake)
		assert.Equal(t, "One600 Nero", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("MSScanner", func(t *testing.T) {
		camera := NewCamera("", "MS Scanner")
		assert.Equal(t, ModelMSScanner, camera.CameraName)
		assert.Equal(t, ModelMSScanner, camera.CameraModel)
		assert.Equal(t, MakeNone, camera.CameraMake)
		assert.Equal(t, ModelMSScanner, camera.CameraModel)
		assert.True(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("SlideNScan", func(t *testing.T) {
		camera := NewCamera("GCMC", "RODFS50")
		assert.Equal(t, MakeKodak+" "+ModelSlideNScan, camera.CameraName)
		assert.Equal(t, CameraTypeFilm, camera.CameraType)
		assert.Equal(t, MakeKodak, camera.CameraMake)
		assert.Equal(t, ModelSlideNScan, camera.CameraModel)
		assert.True(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("DigitDia7000", func(t *testing.T) {
		camera := NewCamera(MakeReflecta, ModelDigitDia7000)
		assert.Equal(t, MakeReflecta+" "+ModelDigitDia7000, camera.CameraName)
		assert.Equal(t, CameraTypeFilm, camera.CameraType)
		assert.Equal(t, MakeReflecta, camera.CameraMake)
		assert.Equal(t, ModelDigitDia7000, camera.CameraModel)
		assert.True(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("HPLaserJetPro", func(t *testing.T) {
		camera := NewCamera(MakeHewlettPackard, "LaserJet Pro")
		assert.Equal(t, CameraTypeScanner, camera.CameraType)
		assert.Equal(t, MakeHewlettPackard, camera.CameraMake)
		assert.Equal(t, "LaserJet Pro", camera.CameraModel)
		assert.True(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("IlceSevenMThreeK", func(t *testing.T) {
		camera := NewCamera(MakeSony, "ILCE-7M3K")
		assert.Equal(t, CameraTypeBody, camera.CameraType)
		assert.Equal(t, MakeSony, camera.CameraMake)
		assert.Equal(t, "Alpha 7 III", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("Xperia1Vi", func(t *testing.T) {
		camera := NewCamera(MakeSony, "Xperia 1 Vi")
		assert.Equal(t, CameraTypePhone, camera.CameraType)
		assert.Equal(t, MakeSony, camera.CameraMake)
		assert.Equal(t, "Xperia 1 Vi", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("ZvOneMTwo", func(t *testing.T) {
		camera := NewCamera(MakeSony, "ZV-1M2")
		assert.Equal(t, CameraTypeCompact, camera.CameraType)
		assert.Equal(t, MakeSony, camera.CameraMake)
		assert.Equal(t, "ZV-1M2", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("MatePadProTwelveTwo", func(t *testing.T) {
		camera := NewCamera(MakeHuawei, "MatePad pro 12.2")
		assert.Equal(t, CameraTypeTablet, camera.CameraType)
		assert.Equal(t, MakeHuawei, camera.CameraMake)
		assert.Equal(t, "MatePad pro 12.2", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("Xiaomi14T", func(t *testing.T) {
		camera := NewCamera(MakeXiaomi, "Xiaomi 14T")
		assert.Equal(t, CameraTypePhone, camera.CameraType)
		assert.Equal(t, MakeXiaomi, camera.CameraMake)
		assert.Equal(t, "14T", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("BlackberryZ30", func(t *testing.T) {
		camera := NewCamera("", "Blackberry Z30")
		assert.Equal(t, CameraTypePhone, camera.CameraType)
		assert.Equal(t, "", camera.CameraMake)
		assert.Equal(t, "BlackBerry Z30", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.True(t, camera.Mobile())
	})
	t.Run("Inst360", func(t *testing.T) {
		camera := NewCamera("", "Insta360")
		assert.Equal(t, CameraType360, camera.CameraType)
		assert.Equal(t, "", camera.CameraMake)
		assert.Equal(t, "Insta360", camera.CameraModel)
		assert.False(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("Lide400", func(t *testing.T) {
		camera := NewCamera(MakeCanon, "Lide 400")
		assert.Equal(t, CameraTypeScanner, camera.CameraType)
		assert.Equal(t, MakeCanon, camera.CameraMake)
		assert.Equal(t, "Lide 400", camera.CameraModel)
		assert.True(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("Scan3000", func(t *testing.T) {
		camera := NewCamera("", "Scanner 3000")
		assert.Equal(t, CameraTypeScanner, camera.CameraType)
		assert.Equal(t, "", camera.CameraMake)
		assert.Equal(t, "Scanner 3000", camera.CameraModel)
		assert.True(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("ScanBrand", func(t *testing.T) {
		camera := NewCamera("ScanBrand", "")
		assert.Equal(t, CameraTypeScanner, camera.CameraType)
		assert.Equal(t, "ScanBrand", camera.CameraMake)
		assert.Equal(t, "", camera.CameraModel)
		assert.True(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("EpsonPerfection", func(t *testing.T) {
		camera := NewCamera("EPSON", "Perfection V800/V850")
		assert.Equal(t, CameraTypeScanner, camera.CameraType)
		assert.Equal(t, "EPSON", camera.CameraMake)
		assert.Equal(t, "Perfection V800/V850", camera.CameraModel)
		assert.True(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
	t.Run("EpsonFastFoto", func(t *testing.T) {
		camera := NewCamera("EPSON", "FastFoto FF-680W")
		assert.Equal(t, CameraTypeScanner, camera.CameraType)
		assert.Equal(t, "EPSON", camera.CameraMake)
		assert.Equal(t, "FastFoto FF-680W", camera.CameraModel)
		assert.True(t, camera.Scanner())
		assert.False(t, camera.Mobile())
	})
}
