CREATE TABLE [dbo].[Profile] (
	[Id]                   INT           IDENTITY (1, 1) NOT NULL,
	[ProfileNumber]        NVARCHAR (50) NOT NULL,
	[LendServiceAccount]   BIT           NULL,
	[BorrowServiceAccount]  BIT           NULL,

	--[ProfileTypeId]        INT           NOT NULL,
	[Title]                NVARCHAR (50) NULL,
	[Name]                 NVARCHAR (50) NOT NULL,
	[Surname]              NVARCHAR (50) NOT NULL,
	[EmailAddress]         NVARCHAR (50) NOT NULL,
	[ContactNumber]        NVARCHAR (50)  NULL,
	[DateOfBirth]          DATETIME      NULL,
	[GenderId]             INT NULL,
	[CountryOfBirthId]     INT           NULL,
	[EthnicityId]          INT           NULL,
	[IdentificationTypeId] INT           NULL,
	[IdentificationNumber] NVARCHAR (50) NOT NULL,
	[AvailableFunds]       FLOAT (53)    NOT NULL,
	[CashDeposit] FLOAT(53)   NULL , 
	[CashWithdrawal] FLOAT(53)   NULL , 
	[TaxRegistered]        BIT           NULL,
	[SourceOfIncomeId]     INT           NULL,
	[OtherSourceOfIncome]  NVARCHAR (50) NULL,
--	[FicaComplianceId]     INT   NULL,
	[EmploymentStatusId]   INT  NULL,
	[StatusId] INT NOT NULL DEFAULT 1, 
	
	[BillingDate] DATETIME NULL DEFAULT GETDATE(), 
	[LastBillDate] DATETIME NULL DEFAULT GETDATE(), 
	CONSTRAINT [PK_Profile] PRIMARY KEY CLUSTERED ([Id] ASC),
	CONSTRAINT [FK_Profile_Country] FOREIGN KEY ([CountryOfBirthId]) REFERENCES [dbo].[Country] ([Id]),
	CONSTRAINT [FK_Profile_Ethnicity] FOREIGN KEY ([EthnicityId]) REFERENCES [dbo].[Ethnicity] ([Id]),
	--CONSTRAINT [FK_Profile_FicaCompliance] FOREIGN KEY ([FicaComplianceId]) REFERENCES [dbo].[FicaCompliance] ([Id]),
	CONSTRAINT [FK_Profile_IdentificationType] FOREIGN KEY ([IdentificationTypeId]) REFERENCES [dbo].[IdentificationType] ([Id]),
	--CONSTRAINT [FK_Profile_ProfileType] FOREIGN KEY ([ProfileTypeId]) REFERENCES [dbo].[ProfileType] ([Id]),
	CONSTRAINT [FK_Profile_SourceOfIncome] FOREIGN KEY ([SourceOfIncomeId]) REFERENCES [dbo].[SourceOfIncome] ([Id]),
	CONSTRAINT [FK_Profile_ProfileStatus] FOREIGN KEY ([StatusId]) REFERENCES [ProfileStatus]([Id]),
	CONSTRAINT [FK_Profile_Gender] FOREIGN KEY ([GenderId]) REFERENCES [Gender]([Id]),
	CONSTRAINT [FK_Profile_EmploymentStatus] FOREIGN KEY ([EmploymentStatusId]) REFERENCES [EmploymentStatus]([Id]), 
);

