{"Customers": {"columns": [[0, "Customer_ID", "INTEGER", 1, null, 1], [1, "Customer_name", "VARCHAR(40)", 0, null, 0]], "primary_keys": ["Customer_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Services": {"columns": [[0, "Service_ID", "INTEGER", 1, null, 1], [1, "Service_name", "VARCHAR(40)", 0, null, 0]], "primary_keys": ["Service_ID"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "Available_Policies": {"columns": [[0, "Policy_ID", "INTEGER", 1, null, 1], [1, "policy_type_code", "CHAR(15)", 0, null, 0], [2, "Customer_Phone", "VARCHAR(255)", 0, null, 0]], "primary_keys": ["Policy_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Policy_ID"]]], "check_constraints": []}, "Customers_Policies": {"columns": [[0, "Customer_ID", "INTEGER", 1, null, 1], [1, "Policy_ID", "INTEGER", 1, null, 2], [2, "Date_Opened", "DATE", 0, null, 0], [3, "Date_Closed", "DATE", 0, null, 0]], "primary_keys": ["Customer_ID", "Policy_ID"], "foreign_keys": [[0, 0, "Available_Policies", "Policy_ID", "Policy_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Customers", "Customer_ID", "Customer_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Customer_ID"], [1, 1, "Policy_ID"]]], "check_constraints": []}, "First_Notification_of_Loss": {"columns": [[0, "FNOL_ID", "INTEGER", 1, null, 1], [1, "Customer_ID", "INTEGER", 1, null, 0], [2, "Policy_ID", "INTEGER", 1, null, 0], [3, "Service_ID", "INTEGER", 1, null, 0]], "primary_keys": ["FNOL_ID"], "foreign_keys": [[0, 0, "Customers_Policies", "Customer_ID", "Customer_ID", "NO ACTION", "NO ACTION", "NONE"], [0, 1, "Customers_Policies", "Policy_ID", "Policy_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "Services", "Service_ID", "Service_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "FNOL_ID"]]], "check_constraints": []}, "Claims": {"columns": [[0, "Claim_ID", "INTEGER", 1, null, 1], [1, "FNOL_ID", "INTEGER", 1, null, 0], [2, "Effective_Date", "DATE", 0, null, 0]], "primary_keys": ["Claim_ID"], "foreign_keys": [[0, 0, "First_Notification_of_Loss", "FNOL_ID", "FNOL_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Claim_ID"]]], "check_constraints": []}, "Settlements": {"columns": [[0, "Settlement_ID", "INTEGER", 1, null, 1], [1, "Claim_ID", "INTEGER", 0, null, 0], [2, "Effective_Date", "DATE", 0, null, 0], [3, "Settlement_Amount", "REAL", 0, null, 0]], "primary_keys": ["Settlement_ID"], "foreign_keys": [[0, 0, "Claims", "Claim_ID", "Claim_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Settlement_ID"]]], "check_constraints": []}}
CREATE TABLE Customers (
    Customer_ID INTEGER NOT NULL  PRIMARY KEY,
    Customer_name VARCHAR(40)
);

CREATE TABLE Services (
    Service_ID INTEGER NOT NULL  PRIMARY KEY,
    Service_name VARCHAR(40)
);

CREATE TABLE Available_Policies (
    Policy_ID INTEGER NOT NULL  PRIMARY KEY,
    policy_type_code CHAR(15),
    Customer_Phone VARCHAR(255),
    UNIQUE (Policy_ID)
);

CREATE TABLE Customers_Policies (
    Customer_ID INTEGER NOT NULL  PRIMARY KEY,
    Policy_ID INTEGER NOT NULL  PRIMARY KEY,
    Date_Opened DATE,
    Date_Closed DATE,
    PRIMARY KEY (Customer_ID, Policy_ID),
    UNIQUE (Customer_ID, Policy_ID),
    FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),
    FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)
);

CREATE TABLE First_Notification_of_Loss (
    FNOL_ID INTEGER NOT NULL  PRIMARY KEY,
    Customer_ID INTEGER NOT NULL,
    Policy_ID INTEGER NOT NULL,
    Service_ID INTEGER NOT NULL,
    UNIQUE (FNOL_ID),
    FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),
    FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),
    FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)
);

CREATE TABLE Claims (
    Claim_ID INTEGER NOT NULL  PRIMARY KEY,
    FNOL_ID INTEGER NOT NULL,
    Effective_Date DATE,
    UNIQUE (Claim_ID),
    FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)
);

CREATE TABLE Settlements (
    Settlement_ID INTEGER NOT NULL  PRIMARY KEY,
    Claim_ID INTEGER,
    Effective_Date DATE,
    Settlement_Amount REAL,
    UNIQUE (Settlement_ID),
    FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)
);