--
--


-- Started on 2026-02-05 17:54:45

CREATE TABLE public.acl_actions (
    id integer NOT NULL,
    name character varying(50) NOT NULL,
    description text,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by character varying(255) NOT NULL,
    updated_by character varying(255) NOT NULL,
    action_key character varying(100)
);


ALTER TABLE public.acl_actions OWNER TO nl2sql_ai;

--
-- TOC entry 233 (class 1259 OID 27661571)
-- Name: acl_categories; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.acl_categories (
    id integer NOT NULL,
    name character varying(50) NOT NULL,
    description text,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by character varying(255) NOT NULL,
    updated_by character varying(255) NOT NULL,
    parent character varying(100),
    category_key character varying(100),
    application_scope character varying(100)
);


ALTER TABLE public.acl_categories OWNER TO nl2sql_ai;

--
-- TOC entry 234 (class 1259 OID 27661578)
-- Name: acl_category_action_api_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.acl_category_action_api_map (
    id integer NOT NULL,
    acl_category_action_id integer,
    api character varying(255),
    method character varying(10),
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    created_by character varying(255),
    updated_by character varying(255)
);


ALTER TABLE public.acl_category_action_api_map OWNER TO nl2sql_ai;

--
-- TOC entry 235 (class 1259 OID 27661583)
-- Name: acl_category_action_api_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.acl_category_action_api_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.acl_category_action_api_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 8992 (class 0 OID 0)
-- Dependencies: 235
-- Name: acl_category_action_api_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.acl_category_action_api_map_id_seq OWNED BY public.acl_category_action_api_map.id;


--
-- TOC entry 236 (class 1259 OID 27661584)
-- Name: acl_category_action_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.acl_category_action_map (
    id integer NOT NULL,
    acl_category_id integer NOT NULL,
    acl_action_id integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by character varying(255) NOT NULL,
    updated_by character varying(255) NOT NULL
);


ALTER TABLE public.acl_category_action_map OWNER TO nl2sql_ai;

--
-- TOC entry 237 (class 1259 OID 27661591)
-- Name: acl_category_action_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.acl_category_action_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.acl_category_action_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 8993 (class 0 OID 0)
-- Dependencies: 237
-- Name: acl_category_action_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.acl_category_action_map_id_seq OWNED BY public.acl_category_action_map.id;


--
-- TOC entry 238 (class 1259 OID 27661592)
-- Name: actions_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.actions_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.actions_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 8994 (class 0 OID 0)
-- Dependencies: 238
-- Name: actions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.actions_id_seq OWNED BY public.acl_actions.id;


--
-- TOC entry 239 (class 1259 OID 27661593)
-- Name: address; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.address (
    id integer NOT NULL,
    address_type_lid integer,
    addr_1 character varying(255) NOT NULL,
    addr_2 character varying(255),
    area character varying(4000),
    country_id integer NOT NULL,
    state_id integer NOT NULL,
    city_id integer NOT NULL,
    pincode character varying(20),
    phone_number character varying(20),
    alternate_phone_number character varying(20),
    email character varying(100),
    support_number character varying(20),
    fax character varying(50),
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    deleted_at timestamp without time zone,
    landmark character varying(2000)
);


ALTER TABLE public.address OWNER TO nl2sql_ai;

--
-- TOC entry 240 (class 1259 OID 27661600)
-- Name: address_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.address_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.address_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 8995 (class 0 OID 0)
-- Dependencies: 240
-- Name: address_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.address_id_seq OWNED BY public.address.id;


--
-- TOC entry 241 (class 1259 OID 27661601)
-- Name: admin_reports; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.admin_reports (
    id integer NOT NULL,
    name character varying(255),
    label character varying(255),
    end_point character varying(255),
    query text,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    deleted_at timestamp without time zone,
    created_by character varying(255),
    updated_by character varying(255),
    deleted_by character varying(255),
    order_no integer
);


ALTER TABLE public.admin_reports OWNER TO nl2sql_ai;

--
-- TOC entry 242 (class 1259 OID 27661608)
-- Name: admin_reports_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.admin_reports_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.admin_reports_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 8996 (class 0 OID 0)
-- Dependencies: 242
-- Name: admin_reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.admin_reports_id_seq OWNED BY public.admin_reports.id;


--
-- TOC entry 243 (class 1259 OID 27661609)
-- Name: admin_reports_parameters; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.admin_reports_parameters (
    id integer NOT NULL,
    admin_report_id integer,
    parameter_name character varying(255),
    label character varying(255),
    data_type character varying(100),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    deleted_at timestamp without time zone,
    created_by character varying(255),
    updated_by character varying(255),
    deleted_by character varying(255),
    query_parameter character varying(255),
    input_field_type character varying(100),
    option_type character varying(100),
    option jsonb,
    order_no integer
);


ALTER TABLE public.admin_reports_parameters OWNER TO nl2sql_ai;

--
-- TOC entry 244 (class 1259 OID 27661616)
-- Name: admin_reports_parameters_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.admin_reports_parameters_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.admin_reports_parameters_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 8997 (class 0 OID 0)
-- Dependencies: 244
-- Name: admin_reports_parameters_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.admin_reports_parameters_id_seq OWNED BY public.admin_reports_parameters.id;


--
-- TOC entry 245 (class 1259 OID 27661617)
-- Name: admin_reports_results_mappings; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.admin_reports_results_mappings (
    id integer NOT NULL,
    admin_report_id integer,
    query_parameter_name character varying(255),
    variable_name character varying(255),
    label character varying(255),
    data_type character varying(100),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    deleted_at timestamp without time zone,
    created_by character varying(255),
    updated_by character varying(255),
    deleted_by character varying(255),
    alignment character varying(100)
);


ALTER TABLE public.admin_reports_results_mappings OWNER TO nl2sql_ai;

--
-- TOC entry 246 (class 1259 OID 27661624)
-- Name: admin_reports_results_mappings_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.admin_reports_results_mappings_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.admin_reports_results_mappings_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 8998 (class 0 OID 0)
-- Dependencies: 246
-- Name: admin_reports_results_mappings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.admin_reports_results_mappings_id_seq OWNED BY public.admin_reports_results_mappings.id;


--
-- TOC entry 247 (class 1259 OID 27661625)
-- Name: ai_conversation; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.ai_conversation (
    id integer NOT NULL,
    user_id integer,
    title character varying(255),
    status character varying(50) DEFAULT 'active'::character varying,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    deleted_at timestamp without time zone,
    created_by integer,
    updated_by integer
);


ALTER TABLE public.ai_conversation OWNER TO nl2sql_ai;

--
-- TOC entry 248 (class 1259 OID 27661629)
-- Name: ai_conversation_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.ai_conversation_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.ai_conversation_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 8999 (class 0 OID 0)
-- Dependencies: 248
-- Name: ai_conversation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.ai_conversation_id_seq OWNED BY public.ai_conversation.id;


--
-- TOC entry 249 (class 1259 OID 27661630)
-- Name: ai_conversation_message; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.ai_conversation_message (
    id integer NOT NULL,
    conversation_id integer NOT NULL,
    message_type character varying(50),
    message_author character varying(50),
    message text,
    reference_message_id integer,
    parent_message_id integer,
    sql_query text,
    metadata jsonb,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    created_by integer,
    updated_by integer
);


ALTER TABLE public.ai_conversation_message OWNER TO nl2sql_ai;

--
-- TOC entry 250 (class 1259 OID 27661635)
-- Name: ai_conversation_message_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.ai_conversation_message_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.ai_conversation_message_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9000 (class 0 OID 0)
-- Dependencies: 250
-- Name: ai_conversation_message_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.ai_conversation_message_id_seq OWNED BY public.ai_conversation_message.id;


--
-- TOC entry 251 (class 1259 OID 27661636)
-- Name: zz_load_all_table_user_update_status; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.zz_load_all_table_user_update_status (
    id integer NOT NULL,
    table_name text,
    column_name text,
    status text,
    issue_count integer,
    issue_ids text,
    remarks text,
    update_time timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.zz_load_all_table_user_update_status OWNER TO nl2sql_ai;

--
-- TOC entry 252 (class 1259 OID 27661642)
-- Name: all_table_user_update_status_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.all_table_user_update_status_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.all_table_user_update_status_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9001 (class 0 OID 0)
-- Dependencies: 252
-- Name: all_table_user_update_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.all_table_user_update_status_id_seq OWNED BY public.zz_load_all_table_user_update_status.id;


--
-- TOC entry 253 (class 1259 OID 27661643)
-- Name: announcement; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.announcement (
    id integer NOT NULL,
    organisation_id integer NOT NULL,
    title character varying(255) NOT NULL,
    description text,
    expiry_date date NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL
);


ALTER TABLE public.announcement OWNER TO nl2sql_ai;

--
-- TOC entry 254 (class 1259 OID 27661650)
-- Name: announcement_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.announcement_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.announcement_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9002 (class 0 OID 0)
-- Dependencies: 254
-- Name: announcement_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.announcement_id_seq OWNED BY public.announcement.id;


--
-- TOC entry 255 (class 1259 OID 27661651)
-- Name: archived_file_upload; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.archived_file_upload (
    id integer NOT NULL,
    ref_file_upload_id integer NOT NULL,
    file_key text NOT NULL,
    company_type character varying(255) NOT NULL,
    company_id integer,
    upload_type character varying(50) NOT NULL,
    document_type_lid integer NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    deleted_at timestamp without time zone,
    new_file_key text,
    opportunity_id integer,
    opportunity_activity_id integer,
    meeting_id integer,
    policy_id integer,
    claim_id integer,
    claim_activity_id integer
);


ALTER TABLE public.archived_file_upload OWNER TO nl2sql_ai;

--
-- TOC entry 256 (class 1259 OID 27661658)
-- Name: archived_file_upload_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.archived_file_upload_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.archived_file_upload_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9003 (class 0 OID 0)
-- Dependencies: 256
-- Name: archived_file_upload_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.archived_file_upload_id_seq OWNED BY public.archived_file_upload.id;


--
-- TOC entry 257 (class 1259 OID 27661659)
-- Name: audit_history_log; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.audit_history_log (
    id bigint NOT NULL,
    entity_type character varying(100) NOT NULL,
    entity_name character varying(100) NOT NULL,
    entity_id character varying(100) NOT NULL,
    action character varying(20) NOT NULL,
    user_id character varying(100),
    ip_address character varying(45),
    user_agent character varying(500),
    request_id character varying(100),
    metadata jsonb,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    type character varying(10)
);


ALTER TABLE public.audit_history_log OWNER TO nl2sql_ai;

--
-- TOC entry 258 (class 1259 OID 27661665)
-- Name: audit_history_log_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.audit_history_log_detail (
    id bigint NOT NULL,
    audit_log_id bigint NOT NULL,
    field_name character varying(100) NOT NULL,
    old_value jsonb,
    new_value jsonb,
    field_type character varying(50) NOT NULL
);


ALTER TABLE public.audit_history_log_detail OWNER TO nl2sql_ai;

--
-- TOC entry 259 (class 1259 OID 27661670)
-- Name: audit_log_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.audit_log_detail_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.audit_log_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9004 (class 0 OID 0)
-- Dependencies: 259
-- Name: audit_log_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.audit_log_detail_id_seq OWNED BY public.audit_history_log_detail.id;


--
-- TOC entry 260 (class 1259 OID 27661671)
-- Name: audit_log_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.audit_log_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.audit_log_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9005 (class 0 OID 0)
-- Dependencies: 260
-- Name: audit_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.audit_log_id_seq OWNED BY public.audit_history_log.id;


--
-- TOC entry 261 (class 1259 OID 27661672)
-- Name: authentication_methods; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.authentication_methods (
    id integer NOT NULL,
    method_code character varying(50) NOT NULL,
    method_name character varying(100) NOT NULL,
    description text,
    is_active boolean DEFAULT true,
    configuration jsonb,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    authentication_method_key text
);


ALTER TABLE public.authentication_methods OWNER TO nl2sql_ai;

--
-- TOC entry 262 (class 1259 OID 27661680)
-- Name: authentication_methods_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.authentication_methods_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.authentication_methods_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9006 (class 0 OID 0)
-- Dependencies: 262
-- Name: authentication_methods_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.authentication_methods_id_seq OWNED BY public.authentication_methods.id;


--
-- TOC entry 263 (class 1259 OID 27661681)
-- Name: broker; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.broker (
    id integer NOT NULL,
    broker_name character varying(200) NOT NULL,
    display_name character varying(100) NOT NULL,
    company_type_lid integer NOT NULL,
    website character varying(255),
    remarks character varying(4000),
    created_by integer DEFAULT 0 NOT NULL,
    updated_by integer DEFAULT 0 NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    deleted_at timestamp with time zone,
    status_lid integer,
    audit_ref_id integer,
    country_id integer DEFAULT 2
);


ALTER TABLE public.broker OWNER TO nl2sql_ai;

--
-- TOC entry 264 (class 1259 OID 27661691)
-- Name: broker_address; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.broker_address (
    id integer NOT NULL,
    broker_id integer NOT NULL,
    address_id integer NOT NULL
);


ALTER TABLE public.broker_address OWNER TO nl2sql_ai;

--
-- TOC entry 265 (class 1259 OID 27661694)
-- Name: broker_address_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.broker_address_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.broker_address_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9007 (class 0 OID 0)
-- Dependencies: 265
-- Name: broker_address_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.broker_address_id_seq OWNED BY public.broker_address.id;


--
-- TOC entry 266 (class 1259 OID 27661695)
-- Name: broker_contact; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.broker_contact (
    id integer NOT NULL,
    broker_id integer NOT NULL,
    contact_id integer NOT NULL
);


ALTER TABLE public.broker_contact OWNER TO nl2sql_ai;

--
-- TOC entry 267 (class 1259 OID 27661698)
-- Name: broker_contact_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.broker_contact_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.broker_contact_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9008 (class 0 OID 0)
-- Dependencies: 267
-- Name: broker_contact_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.broker_contact_id_seq OWNED BY public.broker_contact.id;


--
-- TOC entry 268 (class 1259 OID 27661699)
-- Name: broker_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.broker_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.broker_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9009 (class 0 OID 0)
-- Dependencies: 268
-- Name: broker_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.broker_id_seq OWNED BY public.broker.id;


--
-- TOC entry 269 (class 1259 OID 27661700)
-- Name: brokingslip_version_preferred_insurer_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.brokingslip_version_preferred_insurer_detail (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    insurer_id integer,
    location_id integer,
    branch_id integer,
    contact_id integer
);


ALTER TABLE public.brokingslip_version_preferred_insurer_detail OWNER TO nl2sql_ai;

--
-- TOC entry 270 (class 1259 OID 27661703)
-- Name: brokingslip_version_preferred_insurer_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.brokingslip_version_preferred_insurer_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.brokingslip_version_preferred_insurer_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9010 (class 0 OID 0)
-- Dependencies: 270
-- Name: brokingslip_version_preferred_insurer_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.brokingslip_version_preferred_insurer_detail_id_seq OWNED BY public.brokingslip_version_preferred_insurer_detail.id;


--
-- TOC entry 271 (class 1259 OID 27661704)
-- Name: brokingslip_version_preferred_tpa_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.brokingslip_version_preferred_tpa_detail (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    tpa_id integer,
    location_id integer,
    branch_id integer,
    contact_id integer
);


ALTER TABLE public.brokingslip_version_preferred_tpa_detail OWNER TO nl2sql_ai;

--
-- TOC entry 272 (class 1259 OID 27661707)
-- Name: brokingslip_version_preferred_tpa_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.brokingslip_version_preferred_tpa_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.brokingslip_version_preferred_tpa_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9011 (class 0 OID 0)
-- Dependencies: 272
-- Name: brokingslip_version_preferred_tpa_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.brokingslip_version_preferred_tpa_detail_id_seq OWNED BY public.brokingslip_version_preferred_tpa_detail.id;


--
-- TOC entry 273 (class 1259 OID 27661708)
-- Name: business_target; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.business_target (
    id integer NOT NULL,
    user_id integer NOT NULL,
    month date NOT NULL,
    entity_type character varying(150) NOT NULL,
    kpi character varying(150) NOT NULL,
    type_of_target character varying(150) NOT NULL,
    value_of_target numeric(19,2) NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.business_target OWNER TO nl2sql_ai;

--
-- TOC entry 274 (class 1259 OID 27661713)
-- Name: business_target_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.business_target_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.business_target_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9012 (class 0 OID 0)
-- Dependencies: 274
-- Name: business_target_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.business_target_id_seq OWNED BY public.business_target.id;


--
-- TOC entry 275 (class 1259 OID 27661714)
-- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.categories_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.categories_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9013 (class 0 OID 0)
-- Dependencies: 275
-- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.categories_id_seq OWNED BY public.acl_categories.id;


--
-- TOC entry 276 (class 1259 OID 27661715)
-- Name: caution_deposit; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.caution_deposit (
    id integer NOT NULL,
    cd_account_number character varying(50) NOT NULL,
    cd_bank_name character varying(100),
    company_id integer NOT NULL,
    insurer_id integer NOT NULL,
    balance_amount numeric(15,2) NOT NULL,
    remarks text,
    status character varying(50) NOT NULL,
    cd_account_name character varying(100),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone,
    updated_at timestamp with time zone
);


ALTER TABLE public.caution_deposit OWNER TO nl2sql_ai;

--
-- TOC entry 277 (class 1259 OID 27661720)
-- Name: caution_deposit_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.caution_deposit_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.caution_deposit_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9014 (class 0 OID 0)
-- Dependencies: 277
-- Name: caution_deposit_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.caution_deposit_id_seq OWNED BY public.caution_deposit.id;


--
-- TOC entry 278 (class 1259 OID 27661721)
-- Name: caution_deposit_policy_mapping; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.caution_deposit_policy_mapping (
    id integer NOT NULL,
    policy_id integer NOT NULL,
    caution_deposit_id integer NOT NULL,
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone,
    updated_at timestamp with time zone
);


ALTER TABLE public.caution_deposit_policy_mapping OWNER TO nl2sql_ai;

--
-- TOC entry 279 (class 1259 OID 27661724)
-- Name: caution_deposit_policy_mapping_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.caution_deposit_policy_mapping_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.caution_deposit_policy_mapping_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9015 (class 0 OID 0)
-- Dependencies: 279
-- Name: caution_deposit_policy_mapping_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.caution_deposit_policy_mapping_id_seq OWNED BY public.caution_deposit_policy_mapping.id;


--
-- TOC entry 280 (class 1259 OID 27661725)
-- Name: caution_deposit_transaction; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.caution_deposit_transaction (
    id integer NOT NULL,
    caution_deposit_id integer NOT NULL,
    transaction_type character varying(50) NOT NULL,
    endorsement_id integer,
    transaction_amount numeric(19,2) NOT NULL,
    transaction_date timestamp without time zone NOT NULL,
    transaction_reference_id character varying(100),
    reference_type character varying(50),
    bank_name character varying(100),
    cheque_number character varying(30),
    cheque_date date,
    ifsc_code character varying(20),
    remarks text,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    cd_balance_amount numeric(19,2) DEFAULT 0 NOT NULL,
    created_by integer,
    policy_id integer
);


ALTER TABLE public.caution_deposit_transaction OWNER TO nl2sql_ai;

--
-- TOC entry 281 (class 1259 OID 27661731)
-- Name: caution_deposit_transaction_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.caution_deposit_transaction_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.caution_deposit_transaction_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9016 (class 0 OID 0)
-- Dependencies: 281
-- Name: caution_deposit_transaction_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.caution_deposit_transaction_id_seq OWNED BY public.caution_deposit_transaction.id;


--
-- TOC entry 282 (class 1259 OID 27661732)
-- Name: child_details; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.child_details (
    id integer NOT NULL,
    contact_details_id integer NOT NULL,
    child_name character varying(100),
    child_dob date,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    child_gender integer
);


ALTER TABLE public.child_details OWNER TO nl2sql_ai;

--
-- TOC entry 283 (class 1259 OID 27661737)
-- Name: child_details_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.child_details_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.child_details_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9017 (class 0 OID 0)
-- Dependencies: 283
-- Name: child_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.child_details_id_seq OWNED BY public.child_details.id;


--
-- TOC entry 284 (class 1259 OID 27661738)
-- Name: city; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.city (
    id integer NOT NULL,
    name character varying(100) NOT NULL,
    state_id integer NOT NULL
);


ALTER TABLE public.city OWNER TO nl2sql_ai;

--
-- TOC entry 285 (class 1259 OID 27661741)
-- Name: city_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.city_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.city_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9018 (class 0 OID 0)
-- Dependencies: 285
-- Name: city_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.city_id_seq OWNED BY public.city.id;


--
-- TOC entry 286 (class 1259 OID 27661742)
-- Name: claim_activity_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_activity_document_map (
    id integer NOT NULL,
    claim_activity_id integer,
    document_id integer,
    document_label character varying(255),
    received_date date,
    document_status_key character varying(255),
    is_custom integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_activity_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 287 (class 1259 OID 27661749)
-- Name: claim_activity_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_activity_document_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_activity_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9019 (class 0 OID 0)
-- Dependencies: 287
-- Name: claim_activity_document_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_activity_document_map_id_seq OWNED BY public.claim_activity_document_map.id;


--
-- TOC entry 288 (class 1259 OID 27661750)
-- Name: claim_activity_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_activity_map (
    id integer NOT NULL,
    policy_id integer,
    claim_id integer,
    activity_order integer,
    activity_name character varying(255),
    stage_name character varying(255),
    activity_table character varying(255),
    activity_key character varying(100),
    status_key character varying(255),
    claim_number character varying(50),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    completed_at timestamp with time zone,
    deleted_at timestamp with time zone
);


ALTER TABLE public.claim_activity_map OWNER TO nl2sql_ai;

--
-- TOC entry 289 (class 1259 OID 27661757)
-- Name: claim_activity_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_activity_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_activity_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9020 (class 0 OID 0)
-- Dependencies: 289
-- Name: claim_activity_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_activity_map_id_seq OWNED BY public.claim_activity_map.id;


--
-- TOC entry 290 (class 1259 OID 27661758)
-- Name: claim_assessment_report; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_assessment_report (
    id integer NOT NULL,
    claim_activity_id integer,
    report_date date,
    report_by_key character varying(255),
    assessed_loss_amount numeric(19,2),
    key_observations text,
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_assessment_report OWNER TO nl2sql_ai;

--
-- TOC entry 291 (class 1259 OID 27661765)
-- Name: claim_assessment_report_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_assessment_report_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_assessment_report_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9021 (class 0 OID 0)
-- Dependencies: 291
-- Name: claim_assessment_report_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_assessment_report_id_seq OWNED BY public.claim_assessment_report.id;


--
-- TOC entry 292 (class 1259 OID 27661766)
-- Name: claim_customer_agreement; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_customer_agreement (
    id integer NOT NULL,
    claim_activity_id integer,
    agreement_date date,
    customer_confirmation_key character varying(255),
    remarks text,
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_customer_agreement OWNER TO nl2sql_ai;

--
-- TOC entry 293 (class 1259 OID 27661773)
-- Name: claim_customer_agreement_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_customer_agreement_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_customer_agreement_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9022 (class 0 OID 0)
-- Dependencies: 293
-- Name: claim_customer_agreement_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_customer_agreement_id_seq OWNED BY public.claim_customer_agreement.id;


--
-- TOC entry 294 (class 1259 OID 27661774)
-- Name: claim_discharge_voucher; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_discharge_voucher (
    id integer NOT NULL,
    claim_activity_id integer,
    dv_number character varying(100),
    dv_date date,
    dv_amount numeric(19,2),
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_discharge_voucher OWNER TO nl2sql_ai;

--
-- TOC entry 295 (class 1259 OID 27661779)
-- Name: claim_discharge_voucher_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_discharge_voucher_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_discharge_voucher_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9023 (class 0 OID 0)
-- Dependencies: 295
-- Name: claim_discharge_voucher_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_discharge_voucher_id_seq OWNED BY public.claim_discharge_voucher.id;


--
-- TOC entry 296 (class 1259 OID 27661780)
-- Name: claim_document_submission_tracker; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_document_submission_tracker (
    id integer NOT NULL,
    claim_activity_id integer,
    ref_claim_activity_id integer,
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_document_submission_tracker OWNER TO nl2sql_ai;

--
-- TOC entry 297 (class 1259 OID 27661785)
-- Name: claim_document_submission_tracker_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_document_submission_tracker_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_document_submission_tracker_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9024 (class 0 OID 0)
-- Dependencies: 297
-- Name: claim_document_submission_tracker_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_document_submission_tracker_id_seq OWNED BY public.claim_document_submission_tracker.id;


--
-- TOC entry 298 (class 1259 OID 27661786)
-- Name: claim_documents_collected; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_documents_collected (
    id integer NOT NULL,
    claim_activity_id integer,
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_documents_collected OWNER TO nl2sql_ai;

--
-- TOC entry 299 (class 1259 OID 27661791)
-- Name: claim_documents_collected_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_documents_collected_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_documents_collected_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9025 (class 0 OID 0)
-- Dependencies: 299
-- Name: claim_documents_collected_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_documents_collected_id_seq OWNED BY public.claim_documents_collected.id;


--
-- TOC entry 300 (class 1259 OID 27661792)
-- Name: claim_fnol_details; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_fnol_details (
    id integer NOT NULL,
    claim_activity_id integer,
    fnol_sent_date date,
    insurer_reference_no character varying(255),
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_fnol_details OWNER TO nl2sql_ai;

--
-- TOC entry 301 (class 1259 OID 27661799)
-- Name: claim_fnol_details_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_fnol_details_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_fnol_details_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9026 (class 0 OID 0)
-- Dependencies: 301
-- Name: claim_fnol_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_fnol_details_id_seq OWNED BY public.claim_fnol_details.id;


--
-- TOC entry 302 (class 1259 OID 27661800)
-- Name: claim_informed; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_informed (
    id integer NOT NULL,
    claim_activity_id integer,
    intimation_datetime timestamp with time zone,
    intimated_by_key character varying(255),
    intimation_channel_key character varying(255),
    loss_location_id integer,
    description_of_loss text,
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_informed OWNER TO nl2sql_ai;

--
-- TOC entry 303 (class 1259 OID 27661807)
-- Name: claim_informed_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_informed_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_informed_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9027 (class 0 OID 0)
-- Dependencies: 303
-- Name: claim_informed_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_informed_id_seq OWNED BY public.claim_informed.id;


--
-- TOC entry 304 (class 1259 OID 27661808)
-- Name: claim_joint_inspection_report; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_joint_inspection_report (
    id integer NOT NULL,
    claim_activity_id integer,
    inspection_date date,
    inspected_by character varying(255),
    client integer,
    insurer integer,
    adjuster integer,
    surveyor integer,
    inspection_findings text,
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_joint_inspection_report OWNER TO nl2sql_ai;

--
-- TOC entry 305 (class 1259 OID 27661815)
-- Name: claim_joint_inspection_report_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_joint_inspection_report_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_joint_inspection_report_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9028 (class 0 OID 0)
-- Dependencies: 305
-- Name: claim_joint_inspection_report_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_joint_inspection_report_id_seq OWNED BY public.claim_joint_inspection_report.id;


--
-- TOC entry 306 (class 1259 OID 27661816)
-- Name: claim_lor_details; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_lor_details (
    id integer NOT NULL,
    claim_activity_id integer,
    lor_issued_date date,
    issued_by_key character varying(255),
    required_documents text,
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_lor_details OWNER TO nl2sql_ai;

--
-- TOC entry 307 (class 1259 OID 27661823)
-- Name: claim_lor_details_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_lor_details_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_lor_details_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9029 (class 0 OID 0)
-- Dependencies: 307
-- Name: claim_lor_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_lor_details_id_seq OWNED BY public.claim_lor_details.id;


--
-- TOC entry 308 (class 1259 OID 27661824)
-- Name: claim_loss_adjuster_details; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_loss_adjuster_details (
    id integer NOT NULL,
    claim_activity_id integer,
    adjuster_appointment_date date,
    adjuster_name character varying(255),
    adjuster_phone character varying(20),
    adjuster_email character varying(255),
    adjuster_appointment_ref_no character varying(50),
    adjuster_assigned_by integer,
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_loss_adjuster_details OWNER TO nl2sql_ai;

--
-- TOC entry 309 (class 1259 OID 27661831)
-- Name: claim_loss_adjuster_details_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_loss_adjuster_details_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_loss_adjuster_details_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9030 (class 0 OID 0)
-- Dependencies: 309
-- Name: claim_loss_adjuster_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_loss_adjuster_details_id_seq OWNED BY public.claim_loss_adjuster_details.id;


--
-- TOC entry 310 (class 1259 OID 27661832)
-- Name: claim_payment; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_payment (
    id integer NOT NULL,
    claim_activity_id integer,
    payment_date date,
    payment_reference_no character varying(255),
    paid_amount numeric(19,2),
    mode_of_payment_key character varying(255),
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_payment OWNER TO nl2sql_ai;

--
-- TOC entry 311 (class 1259 OID 27661839)
-- Name: claim_payment_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_payment_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_payment_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9031 (class 0 OID 0)
-- Dependencies: 311
-- Name: claim_payment_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_payment_id_seq OWNED BY public.claim_payment.id;


--
-- TOC entry 312 (class 1259 OID 27661840)
-- Name: claim_survey_completed; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_survey_completed (
    id integer NOT NULL,
    claim_activity_id integer,
    survey_date date,
    surveyor_name character varying(255),
    findings_summary text,
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_survey_completed OWNER TO nl2sql_ai;

--
-- TOC entry 313 (class 1259 OID 27661847)
-- Name: claim_survey_completed_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_survey_completed_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_survey_completed_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9032 (class 0 OID 0)
-- Dependencies: 313
-- Name: claim_survey_completed_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_survey_completed_id_seq OWNED BY public.claim_survey_completed.id;


--
-- TOC entry 314 (class 1259 OID 27661848)
-- Name: claim_validation_report; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_validation_report (
    id integer NOT NULL,
    claim_activity_id integer,
    validator_name character varying(255),
    validation_status_key character varying(255),
    validation_date timestamp with time zone,
    remarks text,
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_validation_report OWNER TO nl2sql_ai;

--
-- TOC entry 315 (class 1259 OID 27661855)
-- Name: claim_validation_report_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_validation_report_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_validation_report_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9033 (class 0 OID 0)
-- Dependencies: 315
-- Name: claim_validation_report_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_validation_report_id_seq OWNED BY public.claim_validation_report.id;


--
-- TOC entry 316 (class 1259 OID 27661856)
-- Name: claim_voucher_to_insurer; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.claim_voucher_to_insurer (
    id integer NOT NULL,
    claim_activity_id integer,
    sent_to_insurer_date date,
    acknowledgement_ref_no character varying(255),
    status_key character varying(255),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.claim_voucher_to_insurer OWNER TO nl2sql_ai;

--
-- TOC entry 317 (class 1259 OID 27661863)
-- Name: claim_voucher_to_insurer_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.claim_voucher_to_insurer_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.claim_voucher_to_insurer_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9034 (class 0 OID 0)
-- Dependencies: 317
-- Name: claim_voucher_to_insurer_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.claim_voucher_to_insurer_id_seq OWNED BY public.claim_voucher_to_insurer.id;


--
-- TOC entry 318 (class 1259 OID 27661864)
-- Name: company; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.company (
    id integer NOT NULL,
    company_name character varying(200) NOT NULL,
    display_name character varying(4000),
    company_type_lid integer,
    company_tag_lid integer,
    currency_id integer,
    industry_segment_lid integer,
    no_of_employees integer,
    website character varying(255),
    date_of_incorporation date,
    pan_card_number character varying(50),
    registration_no character varying(50),
    existing_broker_id integer,
    paid_up_capital numeric(15,2),
    tan_number character varying(50),
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    approver_id integer,
    status_lid integer,
    priority_lid integer,
    remarks character varying(4000),
    source character varying(100),
    group_company_lid integer,
    lead_crm integer,
    country_id integer,
    account_manager integer,
    source_type_lid integer,
    sentiment_lid integer,
    annual_premium numeric,
    additional_fields jsonb,
    service_tax character varying(50),
    audit_ref_id integer,
    total_sum_insured numeric(18,2) DEFAULT 0,
    so_count integer DEFAULT 0,
    so_total_premium numeric(18,2) DEFAULT 0,
    ro_count integer DEFAULT 0,
    ro_total_premium numeric(18,2) DEFAULT 0,
    policy_count integer DEFAULT 0,
    policy_total_premium numeric(18,2) DEFAULT 0,
    brokerage numeric(18,2) DEFAULT 0,
    claim_amount numeric(18,2) DEFAULT 0
);


ALTER TABLE public.company OWNER TO nl2sql_ai;

--
-- TOC entry 319 (class 1259 OID 27661880)
-- Name: company_address; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.company_address (
    id integer NOT NULL,
    company_id integer NOT NULL,
    address_id integer NOT NULL,
    is_primary boolean DEFAULT false,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    deleted_at timestamp with time zone
);


ALTER TABLE public.company_address OWNER TO nl2sql_ai;

--
-- TOC entry 320 (class 1259 OID 27661886)
-- Name: company_address_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.company_address_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.company_address_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9035 (class 0 OID 0)
-- Dependencies: 320
-- Name: company_address_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.company_address_id_seq OWNED BY public.company_address.id;


--
-- TOC entry 321 (class 1259 OID 27661887)
-- Name: company_authentication_config; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.company_authentication_config (
    id integer NOT NULL,
    company_id integer NOT NULL,
    authentication_method_id integer NOT NULL,
    company_portal_auth_config jsonb,
    created_by integer,
    created_at timestamp without time zone DEFAULT now(),
    updated_by integer,
    updated_at timestamp without time zone DEFAULT now(),
    authentication_method_key text
);


ALTER TABLE public.company_authentication_config OWNER TO nl2sql_ai;

--
-- TOC entry 322 (class 1259 OID 27661894)
-- Name: company_authentication_config_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.company_authentication_config_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.company_authentication_config_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9036 (class 0 OID 0)
-- Dependencies: 322
-- Name: company_authentication_config_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.company_authentication_config_id_seq OWNED BY public.company_authentication_config.id;


--
-- TOC entry 323 (class 1259 OID 27661895)
-- Name: company_authentication_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.company_authentication_map (
    id integer NOT NULL,
    company_id integer NOT NULL,
    authentication_method_id integer NOT NULL,
    is_enabled boolean DEFAULT true,
    display_order integer DEFAULT 1,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    authentication_method_key text,
    created_by integer,
    updated_by integer,
    company_portal_auth_config_id integer
);


ALTER TABLE public.company_authentication_map OWNER TO nl2sql_ai;

--
-- TOC entry 324 (class 1259 OID 27661904)
-- Name: company_authentication_mapping_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.company_authentication_mapping_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.company_authentication_mapping_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9037 (class 0 OID 0)
-- Dependencies: 324
-- Name: company_authentication_mapping_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.company_authentication_mapping_id_seq OWNED BY public.company_authentication_map.id;


--
-- TOC entry 325 (class 1259 OID 27661905)
-- Name: company_contact; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.company_contact (
    id integer NOT NULL,
    contact_id integer NOT NULL,
    company_id integer NOT NULL
);


ALTER TABLE public.company_contact OWNER TO nl2sql_ai;

--
-- TOC entry 326 (class 1259 OID 27661908)
-- Name: company_contact_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.company_contact_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.company_contact_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9038 (class 0 OID 0)
-- Dependencies: 326
-- Name: company_contact_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.company_contact_id_seq OWNED BY public.company_contact.id;


--
-- TOC entry 327 (class 1259 OID 27661909)
-- Name: company_contact_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.company_contact_map (
    id integer NOT NULL,
    company_id integer NOT NULL,
    contact_id integer NOT NULL
);


ALTER TABLE public.company_contact_map OWNER TO nl2sql_ai;

--
-- TOC entry 328 (class 1259 OID 27661912)
-- Name: company_contact_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.company_contact_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.company_contact_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9039 (class 0 OID 0)
-- Dependencies: 328
-- Name: company_contact_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.company_contact_map_id_seq OWNED BY public.company_contact_map.id;


--
-- TOC entry 329 (class 1259 OID 27661913)
-- Name: company_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.company_detail (
    id integer NOT NULL,
    company_id integer NOT NULL,
    company_history text,
    major_products text,
    key_customers character varying(1500),
    documents_uploaded text,
    business_processes character varying(1500),
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    account_strategy character varying(1500),
    targeting_reason character varying(1500),
    competitor character varying(1500),
    weakness character varying(1500),
    action_plan character varying(1500),
    potential_opportunity text,
    industry_intelligence text,
    service_plan character varying(1500),
    acquisition_history character varying(1500),
    biz_profile character varying(1500),
    service_performance character varying(1500),
    sentiment character varying,
    sales_pitch text,
    ai_sales_pitch text
);


ALTER TABLE public.company_detail OWNER TO nl2sql_ai;

--
-- TOC entry 330 (class 1259 OID 27661920)
-- Name: company_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.company_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.company_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9040 (class 0 OID 0)
-- Dependencies: 330
-- Name: company_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.company_detail_id_seq OWNED BY public.company_detail.id;


--
-- TOC entry 331 (class 1259 OID 27661921)
-- Name: company_doc_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.company_doc_map (
    id integer NOT NULL,
    company_id integer NOT NULL,
    doc_id integer NOT NULL
);


ALTER TABLE public.company_doc_map OWNER TO nl2sql_ai;

--
-- TOC entry 332 (class 1259 OID 27661924)
-- Name: company_doc_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.company_doc_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.company_doc_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9041 (class 0 OID 0)
-- Dependencies: 332
-- Name: company_doc_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.company_doc_map_id_seq OWNED BY public.company_doc_map.id;


--
-- TOC entry 333 (class 1259 OID 27661925)
-- Name: state_gst_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.state_gst_detail (
    id integer NOT NULL,
    state_id integer NOT NULL,
    gst_number character varying(15) NOT NULL,
    gst_category_lid integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    company_id integer NOT NULL,
    deleted_at timestamp with time zone
);


ALTER TABLE public.state_gst_detail OWNER TO nl2sql_ai;

--
-- TOC entry 334 (class 1259 OID 27661930)
-- Name: company_gst_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.company_gst_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.company_gst_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9042 (class 0 OID 0)
-- Dependencies: 334
-- Name: company_gst_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.company_gst_detail_id_seq OWNED BY public.state_gst_detail.id;


--
-- TOC entry 335 (class 1259 OID 27661931)
-- Name: company_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.company_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.company_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9043 (class 0 OID 0)
-- Dependencies: 335
-- Name: company_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.company_id_seq OWNED BY public.company.id;


--
-- TOC entry 336 (class 1259 OID 27661932)
-- Name: company_portal_configuration; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.company_portal_configuration (
    id integer NOT NULL,
    sub_domain character varying(255),
    company_id integer,
    company_database_id integer,
    created_by integer,
    created_at timestamp without time zone,
    updated_by integer,
    updated_at timestamp without time zone,
    deleted_by integer,
    deleted_at timestamp without time zone,
    company_portal_url text,
    company_logo_file_id integer,
    company_configuration_status_lid integer,
    approved_by integer,
    approved_at timestamp without time zone,
    rejected_by integer,
    rejected_at timestamp without time zone,
    approval_comments text,
    is_company_config boolean DEFAULT false NOT NULL,
    company_portal_configuration_detail_id integer
);


ALTER TABLE public.company_portal_configuration OWNER TO nl2sql_ai;

--
-- TOC entry 337 (class 1259 OID 27661938)
-- Name: company_portal_configuration_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.company_portal_configuration_detail (
    id integer NOT NULL,
    company_id integer NOT NULL,
    company_portal_dashboard_config jsonb,
    company_policy_config jsonb,
    company_portal_branding_config jsonb,
    is_company_config boolean DEFAULT false NOT NULL,
    created_by integer,
    created_at timestamp without time zone DEFAULT now(),
    updated_by integer,
    updated_at timestamp without time zone DEFAULT now()
);


ALTER TABLE public.company_portal_configuration_detail OWNER TO nl2sql_ai;

--
-- TOC entry 338 (class 1259 OID 27661946)
-- Name: company_portal_configuration_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.company_portal_configuration_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.company_portal_configuration_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9044 (class 0 OID 0)
-- Dependencies: 338
-- Name: company_portal_configuration_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.company_portal_configuration_detail_id_seq OWNED BY public.company_portal_configuration_detail.id;


--
-- TOC entry 339 (class 1259 OID 27661947)
-- Name: company_rule_mapping; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.company_rule_mapping (
    id integer NOT NULL,
    company_id integer NOT NULL,
    rule_id integer NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    created_by character varying(100),
    updated_by character varying(100)
);


ALTER TABLE public.company_rule_mapping OWNER TO nl2sql_ai;

--
-- TOC entry 340 (class 1259 OID 27661952)
-- Name: company_rule_mapping_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.company_rule_mapping_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.company_rule_mapping_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9045 (class 0 OID 0)
-- Dependencies: 340
-- Name: company_rule_mapping_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.company_rule_mapping_id_seq OWNED BY public.company_rule_mapping.id;


--
-- TOC entry 341 (class 1259 OID 27661953)
-- Name: company_strategy; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.company_strategy (
    id integer NOT NULL,
    company_id integer NOT NULL,
    strategy_for_the_account text,
    reason_for_targeting text,
    competition_for_the_account text,
    weakness text,
    action_plan text,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    deleted_at timestamp with time zone,
    created_by character varying(255),
    updated_by character varying(255)
);


ALTER TABLE public.company_strategy OWNER TO nl2sql_ai;

--
-- TOC entry 342 (class 1259 OID 27661960)
-- Name: company_strategy_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.company_strategy_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.company_strategy_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9046 (class 0 OID 0)
-- Dependencies: 342
-- Name: company_strategy_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.company_strategy_id_seq OWNED BY public.company_strategy.id;


--
-- TOC entry 343 (class 1259 OID 27661961)
-- Name: config_company_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.config_company_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.config_company_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9047 (class 0 OID 0)
-- Dependencies: 343
-- Name: config_company_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.config_company_id_seq OWNED BY public.company_portal_configuration.id;


--
-- TOC entry 344 (class 1259 OID 27661962)
-- Name: contact; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.contact (
    id integer NOT NULL,
    title_id integer,
    salutation_lid integer,
    first_name character varying(100) NOT NULL,
    last_name character varying(100) NOT NULL,
    middle_name character varying(100),
    display_name character varying(100),
    company_location_id integer NOT NULL,
    company_branch_id integer,
    tag_lid integer,
    contact_type_lid integer,
    department character varying(100),
    designation character varying(100),
    department_id integer,
    designation_id integer,
    reporting_to_id integer,
    assistant_id integer,
    remarks character varying(1500),
    status_lid integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    contact_record_type_lid integer NOT NULL,
    linkedin_url text,
    relationship_type_lid integer
);


ALTER TABLE public.contact OWNER TO nl2sql_ai;

--
-- TOC entry 345 (class 1259 OID 27661969)
-- Name: contact_address; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.contact_address (
    id integer NOT NULL,
    contact_id integer NOT NULL,
    address_id integer NOT NULL
);


ALTER TABLE public.contact_address OWNER TO nl2sql_ai;

--
-- TOC entry 346 (class 1259 OID 27661972)
-- Name: contact_address_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.contact_address_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.contact_address_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9048 (class 0 OID 0)
-- Dependencies: 346
-- Name: contact_address_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.contact_address_id_seq OWNED BY public.contact_address.id;


--
-- TOC entry 347 (class 1259 OID 27661973)
-- Name: contact_communication_details; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.contact_communication_details (
    id integer NOT NULL,
    contact_id integer NOT NULL,
    communication_type character varying(50) NOT NULL,
    communication_details character varying(255) NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    is_primary boolean DEFAULT false NOT NULL
);


ALTER TABLE public.contact_communication_details OWNER TO nl2sql_ai;

--
-- TOC entry 348 (class 1259 OID 27661979)
-- Name: contact_communication_details_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.contact_communication_details_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.contact_communication_details_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9049 (class 0 OID 0)
-- Dependencies: 348
-- Name: contact_communication_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.contact_communication_details_id_seq OWNED BY public.contact_communication_details.id;


--
-- TOC entry 349 (class 1259 OID 27661980)
-- Name: contact_details; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.contact_details (
    id integer NOT NULL,
    contact_id integer NOT NULL,
    gender integer,
    date_of_birth date,
    website character varying(255),
    favourite_food character varying(100),
    favourite_restaurant character varying(100),
    personal_history text,
    major_achievements text,
    marital_status integer,
    date_of_wedding date,
    spouse_name character varying(100),
    spouse_date_of_birth date,
    spouse_working_status integer,
    working_company character varying(100),
    child_name character varying(100),
    child_dob date,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    im_address character varying(255),
    type_of_business_id integer,
    network_value numeric(15,2),
    CONSTRAINT contact_details_major_achievements_check CHECK ((length(major_achievements) <= 500)),
    CONSTRAINT contact_details_personal_history_check CHECK ((length(personal_history) <= 500))
);


ALTER TABLE public.contact_details OWNER TO nl2sql_ai;

--
-- TOC entry 350 (class 1259 OID 27661989)
-- Name: contact_details_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.contact_details_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.contact_details_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9050 (class 0 OID 0)
-- Dependencies: 350
-- Name: contact_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.contact_details_id_seq OWNED BY public.contact_details.id;


--
-- TOC entry 351 (class 1259 OID 27661990)
-- Name: contact_doc_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.contact_doc_map (
    id integer NOT NULL,
    contact_id integer NOT NULL,
    doc_id integer NOT NULL
);


ALTER TABLE public.contact_doc_map OWNER TO nl2sql_ai;

--
-- TOC entry 352 (class 1259 OID 27661993)
-- Name: contact_doc_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.contact_doc_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.contact_doc_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9051 (class 0 OID 0)
-- Dependencies: 352
-- Name: contact_doc_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.contact_doc_map_id_seq OWNED BY public.contact_doc_map.id;


--
-- TOC entry 353 (class 1259 OID 27661994)
-- Name: contact_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.contact_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.contact_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9052 (class 0 OID 0)
-- Dependencies: 353
-- Name: contact_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.contact_id_seq OWNED BY public.contact.id;


--
-- TOC entry 354 (class 1259 OID 27661995)
-- Name: country; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.country (
    id integer NOT NULL,
    name character varying(100) NOT NULL,
    iso_code character varying(10),
    region_id integer NOT NULL
);


ALTER TABLE public.country OWNER TO nl2sql_ai;

--
-- TOC entry 355 (class 1259 OID 27661998)
-- Name: country_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.country_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.country_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9053 (class 0 OID 0)
-- Dependencies: 355
-- Name: country_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.country_id_seq OWNED BY public.country.id;


--
-- TOC entry 217 (class 1259 OID 12820190)
-- Name: currency_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.currency_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.currency_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 356 (class 1259 OID 27661999)
-- Name: currency; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.currency (
    id integer DEFAULT nextval('public.currency_id_seq'::regclass) NOT NULL,
    name character varying(255) NOT NULL,
    value character varying(10) NOT NULL,
    description text,
    country_id integer,
    created_by integer,
    updated_by integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.currency OWNER TO nl2sql_ai;

--
-- TOC entry 218 (class 1259 OID 12820199)
-- Name: data_validation_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.data_validation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.data_validation_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 357 (class 1259 OID 27662007)
-- Name: org_department; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.org_department (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    description text,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by character varying(255) NOT NULL,
    updated_by character varying(255) NOT NULL,
    vertical_id integer,
    deleted_at timestamp with time zone,
    status_lid integer DEFAULT 16101
);


ALTER TABLE public.org_department OWNER TO nl2sql_ai;

--
-- TOC entry 358 (class 1259 OID 27662015)
-- Name: department_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.department_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.department_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9054 (class 0 OID 0)
-- Dependencies: 358
-- Name: department_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.department_id_seq OWNED BY public.org_department.id;


--
-- TOC entry 359 (class 1259 OID 27662016)
-- Name: org_designation; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.org_designation (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    description text,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by character varying(255) NOT NULL,
    updated_by character varying(255) NOT NULL,
    grade_level integer,
    deleted_at timestamp with time zone,
    status_lid integer DEFAULT 16101,
    organisation_id integer
);


ALTER TABLE public.org_designation OWNER TO nl2sql_ai;

--
-- TOC entry 360 (class 1259 OID 27662024)
-- Name: designation_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.designation_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.designation_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9055 (class 0 OID 0)
-- Dependencies: 360
-- Name: designation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.designation_id_seq OWNED BY public.org_designation.id;


--
-- TOC entry 361 (class 1259 OID 27662025)
-- Name: document; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.document (
    id integer NOT NULL,
    doc_type_lid integer NOT NULL,
    name character varying(255) NOT NULL,
    url text NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by character varying(255) NOT NULL,
    updated_by character varying(255) NOT NULL
);


ALTER TABLE public.document OWNER TO nl2sql_ai;

--
-- TOC entry 362 (class 1259 OID 27662032)
-- Name: document_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.document_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.document_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9056 (class 0 OID 0)
-- Dependencies: 362
-- Name: document_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.document_id_seq OWNED BY public.document.id;


--
-- TOC entry 363 (class 1259 OID 27662033)
-- Name: document_processing_file; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.document_processing_file (
    id integer NOT NULL,
    entity_type character varying(50) NOT NULL,
    entity_id integer NOT NULL,
    document_id integer NOT NULL,
    document_type character varying(50) NOT NULL,
    process_status character varying(20) DEFAULT 'CREATED'::character varying NOT NULL,
    created_by integer DEFAULT 0 NOT NULL,
    updated_by integer DEFAULT 0 NOT NULL,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    endorsement_id integer,
    expected_employees_count integer,
    expected_dependents_count integer
);


ALTER TABLE public.document_processing_file OWNER TO nl2sql_ai;

--
-- TOC entry 364 (class 1259 OID 27662041)
-- Name: document_processing_file_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.document_processing_file_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.document_processing_file_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9057 (class 0 OID 0)
-- Dependencies: 364
-- Name: document_processing_file_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.document_processing_file_id_seq OWNED BY public.document_processing_file.id;


--
-- TOC entry 365 (class 1259 OID 27662042)
-- Name: employee; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.employee (
    id integer NOT NULL,
    first_name character varying(100) NOT NULL,
    last_name character varying(100) NOT NULL,
    email_id character varying(150) NOT NULL,
    mobile character varying(20) NOT NULL,
    user_id integer NOT NULL,
    branch_id integer,
    department_id integer NOT NULL,
    designation_id integer NOT NULL,
    reporting_user_id integer,
    iirm_emp_id character varying(100) NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    salutation_lid integer,
    reporting_manager_employee_id integer,
    status_lid integer,
    deleted_at timestamp without time zone,
    organisation_id integer,
    vertical_id integer,
    sbu_id integer,
    date_of_birth date,
    date_of_joining date,
    profile_url text
);


ALTER TABLE public.employee OWNER TO nl2sql_ai;

--
-- TOC entry 366 (class 1259 OID 27662049)
-- Name: employee_hierarchy; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.employee_hierarchy (
    id integer NOT NULL,
    user_id integer,
    reporting_user_id integer,
    created_by integer,
    updated_by integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.employee_hierarchy OWNER TO nl2sql_ai;

--
-- TOC entry 367 (class 1259 OID 27662054)
-- Name: employee_hierarchy_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.employee_hierarchy_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.employee_hierarchy_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9058 (class 0 OID 0)
-- Dependencies: 367
-- Name: employee_hierarchy_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.employee_hierarchy_id_seq OWNED BY public.employee_hierarchy.id;


--
-- TOC entry 368 (class 1259 OID 27662055)
-- Name: employee_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.employee_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.employee_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9059 (class 0 OID 0)
-- Dependencies: 368
-- Name: employee_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.employee_id_seq OWNED BY public.employee.id;


--
-- TOC entry 369 (class 1259 OID 27662056)
-- Name: endorsement; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.endorsement (
    id integer NOT NULL,
    policy_id integer NOT NULL,
    company_id integer NOT NULL,
    endorsement_type character varying(50),
    endorsement_date timestamp without time zone,
    insurer_endorsement_number character varying(255),
    insurer_endorsement_date timestamp with time zone,
    endorsement_entry_date timestamp with time zone,
    endorsment_file_id integer,
    endorsment_count integer DEFAULT 0,
    ack_file_id integer,
    endorsement_ack_count integer DEFAULT 0,
    sum_insured numeric(18,2),
    premium_at_inception numeric(18,2),
    gross_premium numeric(18,2),
    net_premium numeric(18,2),
    gst_amount numeric(18,2),
    terrorism_amount numeric(18,2),
    date_of_income timestamp with time zone,
    income_type_lid integer,
    basic_brokerage_amount numeric(18,2),
    brokerage_amount_asper_iwork numeric(18,2),
    brokerage_amount_asper_isg numeric(18,2),
    fee_amount numeric(18,2),
    commission_terrorism_amount numeric(18,2),
    other_amount numeric(18,2),
    od_percentage numeric(5,2),
    tp_percentage numeric(5,2),
    net_percentage numeric(5,2),
    share_percentage numeric(5,2),
    terrorism_brokerage_percentage numeric(5,2),
    deal_confirmed_lid integer,
    remarks text,
    financial_non_financially character varying(50),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    basic_brokerage_percentage numeric(5,2),
    income_month timestamp with time zone,
    tpa_document_id integer,
    tpa_processed_count integer DEFAULT 0,
    tpa_acknowledged_date timestamp with time zone,
    tpa_error_count integer DEFAULT 0 NOT NULL,
    tpa_error_file_id integer,
    mig_ref_no character varying(255),
    premium_collected numeric DEFAULT 0,
    ingested_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    ingested_mode character varying(255) DEFAULT 'APPLICATION'::character varying,
    brokerage_collected numeric(19,2),
    endorsement_status character varying(50),
    current_endorsement_step integer,
    os_ticket_number character varying(50),
    insurer_communication_date timestamp with time zone,
    insurer_communication_details text,
    insurer_acknowledgement_number character varying(50),
    insurer_endorsed_employee_count integer,
    insurer_endorsed_dependent_count integer,
    endorsement_effective_date timestamp with time zone,
    client_confirmation_message text,
    client_confirmation_date timestamp with time zone,
    tpa_upload_remarks text,
    endorsment_dependent_count integer,
    employee_endorsement_addition_count integer,
    employee_endorsement_deletion_count integer,
    is_inception boolean,
    enrollment_start_date timestamp with time zone,
    enrollment_end_date timestamp with time zone,
    basic_premium numeric(19,2),
    srcc_amount numeric(19,2),
    admin_charges numeric(19,2),
    cess_amount numeric(19,2),
    gst_percentage numeric(19,2),
    basic_premium_percentage numeric(5,2),
    srcc_percentage numeric(5,2),
    srcc_brokerage_amount numeric(19,2),
    tc_brokerage_amount numeric(19,2)
);


ALTER TABLE public.endorsement OWNER TO nl2sql_ai;

--
-- TOC entry 370 (class 1259 OID 27662070)
-- Name: endorsement_field_mapping; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.endorsement_field_mapping (
    id integer NOT NULL,
    insurer_id integer NOT NULL,
    field_map jsonb NOT NULL
);


ALTER TABLE public.endorsement_field_mapping OWNER TO nl2sql_ai;

--
-- TOC entry 371 (class 1259 OID 27662075)
-- Name: endorsement_field_mapping_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.endorsement_field_mapping_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.endorsement_field_mapping_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9060 (class 0 OID 0)
-- Dependencies: 371
-- Name: endorsement_field_mapping_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.endorsement_field_mapping_id_seq OWNED BY public.endorsement_field_mapping.id;


--
-- TOC entry 372 (class 1259 OID 27662076)
-- Name: endorsement_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.endorsement_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.endorsement_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9061 (class 0 OID 0)
-- Dependencies: 372
-- Name: endorsement_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.endorsement_id_seq OWNED BY public.endorsement.id;


--
-- TOC entry 373 (class 1259 OID 27662077)
-- Name: notification_event_parameter_mapping; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.notification_event_parameter_mapping (
    id integer NOT NULL,
    event_type_id integer NOT NULL,
    parameter_definition_id integer NOT NULL,
    required boolean DEFAULT false
);


ALTER TABLE public.notification_event_parameter_mapping OWNER TO nl2sql_ai;

--
-- TOC entry 374 (class 1259 OID 27662081)
-- Name: event_parameter_mapping_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.event_parameter_mapping_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.event_parameter_mapping_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9062 (class 0 OID 0)
-- Dependencies: 374
-- Name: event_parameter_mapping_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.event_parameter_mapping_id_seq OWNED BY public.notification_event_parameter_mapping.id;


--
-- TOC entry 375 (class 1259 OID 27662082)
-- Name: file_uploads; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.file_uploads (
    id integer NOT NULL,
    file_key text NOT NULL,
    upload_type character varying(50) NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    company_type character varying(100),
    deleted_at timestamp without time zone,
    company_id integer,
    document_type_lid integer,
    opportunity_id integer,
    opportunity_activity_id integer,
    meeting_id integer,
    policy_id integer,
    claim_id integer,
    claim_activity_id integer,
    status character varying(10) DEFAULT 'ACTIVE'::character varying,
    file_size character varying(32),
    CONSTRAINT file_uploads_status_check CHECK (((status)::text = ANY (ARRAY[('ACTIVE'::character varying)::text, ('INACTIVE'::character varying)::text])))
);


ALTER TABLE public.file_uploads OWNER TO nl2sql_ai;

--
-- TOC entry 376 (class 1259 OID 27662091)
-- Name: file_uploads_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.file_uploads_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.file_uploads_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9063 (class 0 OID 0)
-- Dependencies: 376
-- Name: file_uploads_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.file_uploads_id_seq OWNED BY public.file_uploads.id;


--
-- TOC entry 377 (class 1259 OID 27662092)
-- Name: filter_preference; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.filter_preference (
    id integer NOT NULL,
    entity character varying(100) NOT NULL,
    user_id integer,
    filter_name character varying(255),
    filter_type_lid integer NOT NULL,
    default_filter_lid integer NOT NULL,
    filter_json jsonb NOT NULL,
    table_setting_json jsonb NOT NULL,
    status_lid integer NOT NULL,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    deleted_at timestamp with time zone,
    created_by integer DEFAULT 1 NOT NULL,
    updated_by integer DEFAULT 1 NOT NULL
);


ALTER TABLE public.filter_preference OWNER TO nl2sql_ai;

--
-- TOC entry 378 (class 1259 OID 27662099)
-- Name: filter_preference_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.filter_preference_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.filter_preference_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9064 (class 0 OID 0)
-- Dependencies: 378
-- Name: filter_preference_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.filter_preference_id_seq OWNED BY public.filter_preference.id;


--
-- TOC entry 379 (class 1259 OID 27662100)
-- Name: final_negotiation_meeting_summary; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.final_negotiation_meeting_summary (
    id integer NOT NULL,
    meeting_date date NOT NULL,
    start_time timestamp with time zone NOT NULL,
    end_time timestamp with time zone NOT NULL,
    held_at character varying(100) NOT NULL,
    minutes_of_meeting text NOT NULL,
    policy_placed_type_lid integer NOT NULL,
    lead_insurer_id integer,
    only_lead_pays_commission_lid integer,
    finalised_quote_id integer NOT NULL,
    would_change_quote_values_lid integer,
    other_comments text,
    variations text,
    service_level_agreement_days_lid integer,
    document_id integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer NOT NULL,
    updated_by integer NOT NULL
);


ALTER TABLE public.final_negotiation_meeting_summary OWNER TO nl2sql_ai;

--
-- TOC entry 380 (class 1259 OID 27662107)
-- Name: final_negotiation_meeting_summary_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.final_negotiation_meeting_summary_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.final_negotiation_meeting_summary_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9065 (class 0 OID 0)
-- Dependencies: 380
-- Name: final_negotiation_meeting_summary_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.final_negotiation_meeting_summary_id_seq OWNED BY public.final_negotiation_meeting_summary.id;


--
-- TOC entry 381 (class 1259 OID 27662108)
-- Name: final_negotiation_participant_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.final_negotiation_participant_map (
    id integer NOT NULL,
    meeting_summary_id integer NOT NULL,
    participant_id integer NOT NULL
);


ALTER TABLE public.final_negotiation_participant_map OWNER TO nl2sql_ai;

--
-- TOC entry 382 (class 1259 OID 27662111)
-- Name: final_negotiation_participant_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.final_negotiation_participant_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.final_negotiation_participant_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9066 (class 0 OID 0)
-- Dependencies: 382
-- Name: final_negotiation_participant_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.final_negotiation_participant_map_id_seq OWNED BY public.final_negotiation_participant_map.id;


--
-- TOC entry 383 (class 1259 OID 27662112)
-- Name: group_company_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.group_company_map (
    id integer NOT NULL,
    company_id integer NOT NULL,
    group_company_id integer NOT NULL
);


ALTER TABLE public.group_company_map OWNER TO nl2sql_ai;

--
-- TOC entry 384 (class 1259 OID 27662115)
-- Name: group_company_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.group_company_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.group_company_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9067 (class 0 OID 0)
-- Dependencies: 384
-- Name: group_company_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.group_company_map_id_seq OWNED BY public.group_company_map.id;


--
-- TOC entry 385 (class 1259 OID 27662116)
-- Name: opportunity_held_cover_note_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_held_cover_note_document_map (
    id integer NOT NULL,
    held_cover_note_id integer NOT NULL,
    document_id integer NOT NULL,
    document_type_lid integer NOT NULL
);


ALTER TABLE public.opportunity_held_cover_note_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 386 (class 1259 OID 27662119)
-- Name: held_cover_note_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.held_cover_note_document_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.held_cover_note_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9068 (class 0 OID 0)
-- Dependencies: 386
-- Name: held_cover_note_document_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.held_cover_note_document_map_id_seq OWNED BY public.opportunity_held_cover_note_document_map.id;


--
-- TOC entry 387 (class 1259 OID 27662120)
-- Name: hospital_file_upload_tracking; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.hospital_file_upload_tracking (
    id integer NOT NULL,
    policy_id integer NOT NULL,
    file_id integer NOT NULL,
    file_status character varying(50) DEFAULT 'PENDING'::character varying NOT NULL,
    error_count integer DEFAULT 0 NOT NULL,
    success_count integer DEFAULT 0 NOT NULL,
    error_file_id integer,
    success_file_id integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_by integer NOT NULL,
    deleted_at timestamp with time zone,
    deleted_by integer,
    network_hospital_count integer,
    excluded_hospital_count integer,
    total_records integer
);


ALTER TABLE public.hospital_file_upload_tracking OWNER TO nl2sql_ai;

--
-- TOC entry 388 (class 1259 OID 27662128)
-- Name: hospital_file_upload_tracking_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.hospital_file_upload_tracking_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.hospital_file_upload_tracking_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9069 (class 0 OID 0)
-- Dependencies: 388
-- Name: hospital_file_upload_tracking_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.hospital_file_upload_tracking_id_seq OWNED BY public.hospital_file_upload_tracking.id;


--
-- TOC entry 389 (class 1259 OID 27662129)
-- Name: insurer; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.insurer (
    id integer NOT NULL,
    name character varying(200) NOT NULL,
    display_name character varying(100) NOT NULL,
    company_type_lid integer DEFAULT 0,
    website character varying(255),
    is_life_lid integer NOT NULL,
    company_tag_lid integer DEFAULT 0,
    remarks character varying(4000),
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer DEFAULT 0 NOT NULL,
    updated_by integer DEFAULT 0 NOT NULL,
    deleted_at timestamp with time zone,
    insure_code character varying(100),
    status_lid integer DEFAULT 1 NOT NULL,
    country_id integer DEFAULT 2
);


ALTER TABLE public.insurer OWNER TO nl2sql_ai;

--
-- TOC entry 390 (class 1259 OID 27662142)
-- Name: insurer_address; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.insurer_address (
    id integer NOT NULL,
    insurer_id integer NOT NULL,
    address_id integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


ALTER TABLE public.insurer_address OWNER TO nl2sql_ai;

--
-- TOC entry 391 (class 1259 OID 27662147)
-- Name: insurer_address_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.insurer_address_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.insurer_address_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9070 (class 0 OID 0)
-- Dependencies: 391
-- Name: insurer_address_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.insurer_address_id_seq OWNED BY public.insurer_address.id;


--
-- TOC entry 392 (class 1259 OID 27662148)
-- Name: insurer_company_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.insurer_company_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.insurer_company_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9071 (class 0 OID 0)
-- Dependencies: 392
-- Name: insurer_company_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.insurer_company_id_seq OWNED BY public.insurer.id;


--
-- TOC entry 393 (class 1259 OID 27662149)
-- Name: insurer_contact; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.insurer_contact (
    id integer NOT NULL,
    insurer_id integer NOT NULL,
    contact_id integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


ALTER TABLE public.insurer_contact OWNER TO nl2sql_ai;

--
-- TOC entry 394 (class 1259 OID 27662154)
-- Name: insurer_contact_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.insurer_contact_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.insurer_contact_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9072 (class 0 OID 0)
-- Dependencies: 394
-- Name: insurer_contact_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.insurer_contact_id_seq OWNED BY public.insurer_contact.id;


--
-- TOC entry 395 (class 1259 OID 27662155)
-- Name: insurer_participant_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.insurer_participant_map (
    id integer NOT NULL,
    meeting_summary_id integer NOT NULL,
    insurer_id integer NOT NULL,
    share_percentage numeric(5,2) NOT NULL,
    brokerage_percentage numeric(5,2) NOT NULL,
    brokerage_amount numeric(10,2) NOT NULL
);


ALTER TABLE public.insurer_participant_map OWNER TO nl2sql_ai;

--
-- TOC entry 396 (class 1259 OID 27662158)
-- Name: insurer_participant_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.insurer_participant_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.insurer_participant_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9073 (class 0 OID 0)
-- Dependencies: 396
-- Name: insurer_participant_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.insurer_participant_map_id_seq OWNED BY public.insurer_participant_map.id;


--
-- TOC entry 219 (class 1259 OID 12820333)
-- Name: kdm_meeting_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.kdm_meeting_document_map_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.kdm_meeting_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 220 (class 1259 OID 12820334)
-- Name: knowledge_central_document_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.knowledge_central_document_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.knowledge_central_document_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 397 (class 1259 OID 27662159)
-- Name: knowledge_central; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.knowledge_central (
    id integer NOT NULL,
    document_id bigint DEFAULT nextval('public.knowledge_central_document_id_seq'::regclass) NOT NULL,
    version integer DEFAULT 1 NOT NULL,
    title character varying(255) NOT NULL,
    doc_type_id integer NOT NULL,
    status_id integer NOT NULL,
    category_id integer NOT NULL,
    relative_path character varying(255),
    extension character varying(20),
    summary text,
    tags text[],
    access_count integer DEFAULT 0,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    file_name character varying(255)
);


ALTER TABLE public.knowledge_central OWNER TO nl2sql_ai;

--
-- TOC entry 398 (class 1259 OID 27662169)
-- Name: knowledge_central_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.knowledge_central_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.knowledge_central_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9074 (class 0 OID 0)
-- Dependencies: 398
-- Name: knowledge_central_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.knowledge_central_id_seq OWNED BY public.knowledge_central.id;


--
-- TOC entry 399 (class 1259 OID 27662170)
-- Name: localization_company_regulatory_fields; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.localization_company_regulatory_fields (
    id integer NOT NULL,
    field_key character varying NOT NULL,
    data_type character varying NOT NULL,
    required boolean NOT NULL,
    active boolean NOT NULL,
    display_order integer NOT NULL,
    create_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    meta_data jsonb,
    CONSTRAINT localization_company_regulatory_fields_data_type_check CHECK (((data_type)::text = ANY (ARRAY[('string'::character varying)::text, ('date'::character varying)::text, ('number'::character varying)::text])))
);


ALTER TABLE public.localization_company_regulatory_fields OWNER TO nl2sql_ai;

--
-- TOC entry 400 (class 1259 OID 27662178)
-- Name: localization_company_regulatory_fields_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.localization_company_regulatory_fields_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.localization_company_regulatory_fields_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9075 (class 0 OID 0)
-- Dependencies: 400
-- Name: localization_company_regulatory_fields_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.localization_company_regulatory_fields_id_seq OWNED BY public.localization_company_regulatory_fields.id;


--
-- TOC entry 401 (class 1259 OID 27662179)
-- Name: localization_country; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.localization_country (
    id integer NOT NULL,
    name character varying NOT NULL,
    description text,
    iso_code character varying(10),
    locale character varying(20),
    currency_code character varying(10),
    currency_display_name character varying(50),
    currency_format character varying(50),
    number_format character varying(50),
    date_format character varying(20),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    created_by character varying(100),
    updated_by character varying(100),
    phone_number_format character(50),
    mobile_format character(50),
    fax_format character(50),
    pincode_format character(50)
);


ALTER TABLE public.localization_country OWNER TO nl2sql_ai;

--
-- TOC entry 402 (class 1259 OID 27662186)
-- Name: localization_country_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.localization_country_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.localization_country_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9076 (class 0 OID 0)
-- Dependencies: 402
-- Name: localization_country_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.localization_country_id_seq OWNED BY public.localization_country.id;


--
-- TOC entry 403 (class 1259 OID 27662187)
-- Name: localization_regulatory_fields_country_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.localization_regulatory_fields_country_map (
    id integer NOT NULL,
    country_id integer NOT NULL,
    regulatory_key_id integer NOT NULL,
    field_label character varying NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    meta_data jsonb
);


ALTER TABLE public.localization_regulatory_fields_country_map OWNER TO nl2sql_ai;

--
-- TOC entry 404 (class 1259 OID 27662194)
-- Name: localization_regulatory_fields_country_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.localization_regulatory_fields_country_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.localization_regulatory_fields_country_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9077 (class 0 OID 0)
-- Dependencies: 404
-- Name: localization_regulatory_fields_country_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.localization_regulatory_fields_country_map_id_seq OWNED BY public.localization_regulatory_fields_country_map.id;


--
-- TOC entry 405 (class 1259 OID 27662195)
-- Name: localization_report_fields; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.localization_report_fields (
    id integer NOT NULL,
    field_key character varying NOT NULL,
    data_type character varying NOT NULL,
    required boolean NOT NULL,
    active boolean NOT NULL,
    entity_type character varying(30),
    description character varying(200),
    create_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    meta_data jsonb,
    CONSTRAINT localization_report_fields_data_type_check CHECK (((data_type)::text = ANY (ARRAY[('string'::character varying)::text, ('date'::character varying)::text, ('number'::character varying)::text, ('float'::character varying)::text])))
);


ALTER TABLE public.localization_report_fields OWNER TO nl2sql_ai;

--
-- TOC entry 406 (class 1259 OID 27662203)
-- Name: localization_report_fields_country_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.localization_report_fields_country_map (
    id integer NOT NULL,
    country_id integer NOT NULL,
    regulatory_key_id integer NOT NULL,
    report_section character varying NOT NULL,
    activity_section character varying NOT NULL,
    display_order integer NOT NULL,
    field_label character varying NOT NULL,
    field_alias character varying NOT NULL,
    field_value character varying NOT NULL,
    status character varying NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    meta_data jsonb
);


ALTER TABLE public.localization_report_fields_country_map OWNER TO nl2sql_ai;

--
-- TOC entry 407 (class 1259 OID 27662210)
-- Name: localization_report_fields_country_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.localization_report_fields_country_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.localization_report_fields_country_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9078 (class 0 OID 0)
-- Dependencies: 407
-- Name: localization_report_fields_country_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.localization_report_fields_country_map_id_seq OWNED BY public.localization_report_fields_country_map.id;


--
-- TOC entry 408 (class 1259 OID 27662211)
-- Name: localization_report_fields_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.localization_report_fields_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.localization_report_fields_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9079 (class 0 OID 0)
-- Dependencies: 408
-- Name: localization_report_fields_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.localization_report_fields_id_seq OWNED BY public.localization_report_fields.id;


--
-- TOC entry 409 (class 1259 OID 27662212)
-- Name: lookup_data; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.lookup_data (
    id integer NOT NULL,
    lookup_key character varying(255) NOT NULL,
    lookup_name character varying(255) NOT NULL,
    value_key character varying(255) NOT NULL,
    value text NOT NULL,
    description text,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by character varying(255) NOT NULL,
    updated_by character varying(255) NOT NULL,
    lookup_order integer DEFAULT 0,
    deleted_at timestamp with time zone,
    status integer DEFAULT 1,
    organisation_id integer DEFAULT 0
);


ALTER TABLE public.lookup_data OWNER TO nl2sql_ai;

--
-- TOC entry 410 (class 1259 OID 27662222)
-- Name: lookup_data_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.lookup_data_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.lookup_data_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9080 (class 0 OID 0)
-- Dependencies: 410
-- Name: lookup_data_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.lookup_data_id_seq OWNED BY public.lookup_data.id;


--
-- TOC entry 221 (class 1259 OID 12820381)
-- Name: meeting_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.meeting_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.meeting_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 411 (class 1259 OID 27662223)
-- Name: meeting; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.meeting (
    id integer DEFAULT nextval('public.meeting_id_seq'::regclass) NOT NULL,
    activity_id integer,
    opportunity_id integer,
    meeting_type_lid integer NOT NULL,
    company_id integer,
    meeting_date date NOT NULL,
    start_time time with time zone NOT NULL,
    end_time time with time zone NOT NULL,
    duration integer,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    location_type_lid integer,
    meeting_subject character varying(255),
    meeting_agenda text,
    meeting_status_lid integer NOT NULL,
    meeting_rating integer,
    feedback_submitted character varying(255),
    remarks text
);


ALTER TABLE public.meeting OWNER TO nl2sql_ai;

--
-- TOC entry 412 (class 1259 OID 27662231)
-- Name: meeting_challenges_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.meeting_challenges_map (
    id integer NOT NULL,
    meeting_id integer NOT NULL,
    challenge_id integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.meeting_challenges_map OWNER TO nl2sql_ai;

--
-- TOC entry 413 (class 1259 OID 27662236)
-- Name: meeting_challenges_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.meeting_challenges_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.meeting_challenges_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9081 (class 0 OID 0)
-- Dependencies: 413
-- Name: meeting_challenges_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.meeting_challenges_map_id_seq OWNED BY public.meeting_challenges_map.id;


--
-- TOC entry 414 (class 1259 OID 27662237)
-- Name: meeting_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.meeting_document_map (
    id integer NOT NULL,
    meeting_id integer NOT NULL,
    document_id integer NOT NULL,
    document_type_lid integer
);


ALTER TABLE public.meeting_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 415 (class 1259 OID 27662240)
-- Name: meeting_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.meeting_document_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.meeting_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9082 (class 0 OID 0)
-- Dependencies: 415
-- Name: meeting_document_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.meeting_document_map_id_seq OWNED BY public.meeting_document_map.id;


--
-- TOC entry 416 (class 1259 OID 27662241)
-- Name: meeting_next_steps_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.meeting_next_steps_map (
    id integer NOT NULL,
    meeting_id integer NOT NULL,
    next_step_id integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.meeting_next_steps_map OWNER TO nl2sql_ai;

--
-- TOC entry 417 (class 1259 OID 27662246)
-- Name: meeting_next_steps_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.meeting_next_steps_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.meeting_next_steps_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9083 (class 0 OID 0)
-- Dependencies: 417
-- Name: meeting_next_steps_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.meeting_next_steps_map_id_seq OWNED BY public.meeting_next_steps_map.id;


--
-- TOC entry 418 (class 1259 OID 27662247)
-- Name: meeting_outcomes_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.meeting_outcomes_map (
    id integer NOT NULL,
    meeting_id integer NOT NULL,
    outcome_id integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.meeting_outcomes_map OWNER TO nl2sql_ai;

--
-- TOC entry 419 (class 1259 OID 27662252)
-- Name: meeting_outcomes_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.meeting_outcomes_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.meeting_outcomes_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9084 (class 0 OID 0)
-- Dependencies: 419
-- Name: meeting_outcomes_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.meeting_outcomes_map_id_seq OWNED BY public.meeting_outcomes_map.id;


--
-- TOC entry 222 (class 1259 OID 12820412)
-- Name: meeting_participant_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.meeting_participant_map_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.meeting_participant_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 420 (class 1259 OID 27662253)
-- Name: meeting_participant_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.meeting_participant_map (
    id integer DEFAULT nextval('public.meeting_participant_map_id_seq'::regclass) NOT NULL,
    meeting_id integer NOT NULL,
    participant_id integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    participant_record_type character varying(25),
    participant_company_id integer NOT NULL,
    CONSTRAINT meeting_participant_map_participant_record_type_check CHECK (((participant_record_type)::text = ANY (ARRAY[('TPA_CONTACT'::character varying)::text, ('INSURER_CONTACT'::character varying)::text, ('BROKER_CONTACT'::character varying)::text, ('COMPANY_CONTACT'::character varying)::text, ('EMPLOYEE'::character varying)::text])))
);


ALTER TABLE public.meeting_participant_map OWNER TO nl2sql_ai;

--
-- TOC entry 223 (class 1259 OID 12820420)
-- Name: mstr_activity_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_activity_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.mstr_activity_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 421 (class 1259 OID 27662260)
-- Name: mstr_activity; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_activity (
    id integer DEFAULT nextval('public.mstr_activity_id_seq'::regclass) NOT NULL,
    name character varying(200) NOT NULL,
    description text,
    activity_detail_meta jsonb,
    created_by integer DEFAULT 0 NOT NULL,
    updated_by integer DEFAULT 0 NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    opportunity_table character varying(100),
    activity_order integer,
    activity_key character varying(100),
    ro_name character varying(255)
);


ALTER TABLE public.mstr_activity OWNER TO nl2sql_ai;

--
-- TOC entry 422 (class 1259 OID 27662270)
-- Name: mstr_claim_activity; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_claim_activity (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    description text,
    activity_key character varying(100),
    activity_table character varying(255),
    activity_order integer,
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.mstr_claim_activity OWNER TO nl2sql_ai;

--
-- TOC entry 423 (class 1259 OID 27662277)
-- Name: mstr_claim_activity_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_claim_activity_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_claim_activity_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9085 (class 0 OID 0)
-- Dependencies: 423
-- Name: mstr_claim_activity_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_claim_activity_id_seq OWNED BY public.mstr_claim_activity.id;


--
-- TOC entry 424 (class 1259 OID 27662278)
-- Name: mstr_claim_stage; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_claim_stage (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    description text,
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.mstr_claim_stage OWNER TO nl2sql_ai;

--
-- TOC entry 425 (class 1259 OID 27662285)
-- Name: mstr_claim_stage_activity_template; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_claim_stage_activity_template (
    id integer NOT NULL,
    stage_id integer NOT NULL,
    stage_name character varying(255) NOT NULL,
    activity_id integer NOT NULL,
    activity_name character varying(255) NOT NULL,
    activity_key character varying(100),
    activity_table character varying(255),
    stage_activity_order integer,
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.mstr_claim_stage_activity_template OWNER TO nl2sql_ai;

--
-- TOC entry 426 (class 1259 OID 27662292)
-- Name: mstr_claim_stage_activity_template_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_claim_stage_activity_template_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_claim_stage_activity_template_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9086 (class 0 OID 0)
-- Dependencies: 426
-- Name: mstr_claim_stage_activity_template_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_claim_stage_activity_template_id_seq OWNED BY public.mstr_claim_stage_activity_template.id;


--
-- TOC entry 427 (class 1259 OID 27662293)
-- Name: mstr_claim_stage_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_claim_stage_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_claim_stage_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9087 (class 0 OID 0)
-- Dependencies: 427
-- Name: mstr_claim_stage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_claim_stage_id_seq OWNED BY public.mstr_claim_stage.id;


--
-- TOC entry 224 (class 1259 OID 12820431)
-- Name: mstr_cover_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_cover_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.mstr_cover_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 428 (class 1259 OID 27662294)
-- Name: mstr_cover; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_cover (
    id integer DEFAULT nextval('public.mstr_cover_id_seq'::regclass) NOT NULL,
    name text NOT NULL,
    description text,
    cover_type integer,
    input_type character varying(100),
    input_lov jsonb,
    covers_meta jsonb,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer DEFAULT 0 NOT NULL,
    updated_by integer DEFAULT 0 NOT NULL
);


ALTER TABLE public.mstr_cover OWNER TO nl2sql_ai;

--
-- TOC entry 225 (class 1259 OID 12820442)
-- Name: mstr_cover_template_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_cover_template_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.mstr_cover_template_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 429 (class 1259 OID 27662304)
-- Name: mstr_cover_template; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_cover_template (
    id integer DEFAULT nextval('public.mstr_cover_template_id_seq'::regclass) NOT NULL,
    ref_cover_id integer NOT NULL,
    cover_name text,
    cover_description text,
    mandatory character varying(10) DEFAULT 'Yes'::character varying,
    organization_id integer NOT NULL,
    policy_type_id integer NOT NULL,
    display_sequence integer,
    display_category character varying(100),
    cover_type integer,
    input_type character varying(100),
    input_lov jsonb,
    covers_meta jsonb,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer DEFAULT 0 NOT NULL,
    updated_by integer DEFAULT 0 NOT NULL
);


ALTER TABLE public.mstr_cover_template OWNER TO nl2sql_ai;

--
-- TOC entry 430 (class 1259 OID 27662315)
-- Name: mstr_ext_application_ref; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_ext_application_ref (
    id integer NOT NULL,
    label text NOT NULL,
    description text,
    verification_token_api_url text NOT NULL,
    verification_token_api_method character varying(10) NOT NULL,
    verification_token_api_payload jsonb,
    magic_url_api_url text NOT NULL,
    magic_url_api_method character varying(10) NOT NULL,
    magic_url_api_payload jsonb,
    container_category text NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    iss text NOT NULL,
    email character varying(55),
    expires_in character varying(20) DEFAULT '10m'::character varying NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_by integer,
    created_by integer
);


ALTER TABLE public.mstr_ext_application_ref OWNER TO nl2sql_ai;

--
-- TOC entry 431 (class 1259 OID 27662324)
-- Name: mstr_ext_application_ref_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_ext_application_ref_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_ext_application_ref_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9088 (class 0 OID 0)
-- Dependencies: 431
-- Name: mstr_ext_application_ref_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_ext_application_ref_id_seq OWNED BY public.mstr_ext_application_ref.id;


--
-- TOC entry 432 (class 1259 OID 27662325)
-- Name: mstr_hospital; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_hospital (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    address_id integer NOT NULL,
    code character varying(50),
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_by integer NOT NULL,
    deleted_at timestamp with time zone,
    deleted_by integer
);


ALTER TABLE public.mstr_hospital OWNER TO nl2sql_ai;

--
-- TOC entry 433 (class 1259 OID 27662330)
-- Name: mstr_hospital_address; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_hospital_address (
    id integer NOT NULL,
    address_line_1 character varying(200) NOT NULL,
    address_line_2 character varying(200),
    pin_code character varying(20),
    landmark character varying(200),
    phone_number character varying(20),
    alternate_phone_number character varying(20),
    email character varying(100),
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_by integer NOT NULL,
    deleted_at timestamp with time zone,
    deleted_by integer,
    country_id integer,
    country_name character varying(100),
    city_name character varying(100),
    state_name character varying(100)
);


ALTER TABLE public.mstr_hospital_address OWNER TO nl2sql_ai;

--
-- TOC entry 434 (class 1259 OID 27662337)
-- Name: mstr_hospital_address_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_hospital_address_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_hospital_address_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9089 (class 0 OID 0)
-- Dependencies: 434
-- Name: mstr_hospital_address_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_hospital_address_id_seq OWNED BY public.mstr_hospital_address.id;


--
-- TOC entry 435 (class 1259 OID 27662338)
-- Name: mstr_hospital_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_hospital_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_hospital_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9090 (class 0 OID 0)
-- Dependencies: 435
-- Name: mstr_hospital_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_hospital_id_seq OWNED BY public.mstr_hospital.id;


--
-- TOC entry 436 (class 1259 OID 27662339)
-- Name: mstr_nudge; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_nudge (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    description text,
    nudge_template text,
    prompt text,
    endpoint_url text,
    method character varying(20),
    is_enable boolean DEFAULT true,
    org_id integer NOT NULL,
    key character varying(255) NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    created_by integer DEFAULT 1,
    updated_by integer,
    icon_key character varying(255),
    background_color character varying(50),
    template_type character varying(255) DEFAULT 'dynamic'::character varying
);


ALTER TABLE public.mstr_nudge OWNER TO nl2sql_ai;

--
-- TOC entry 437 (class 1259 OID 27662349)
-- Name: mstr_nudge_action; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_nudge_action (
    id integer NOT NULL,
    nudge_id integer,
    action_url text NOT NULL,
    name character varying(255) NOT NULL,
    additional_details text,
    is_enable boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    created_by integer DEFAULT 1,
    updated_by integer
);


ALTER TABLE public.mstr_nudge_action OWNER TO nl2sql_ai;

--
-- TOC entry 438 (class 1259 OID 27662358)
-- Name: mstr_nudge_action_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_nudge_action_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_nudge_action_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9091 (class 0 OID 0)
-- Dependencies: 438
-- Name: mstr_nudge_action_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_nudge_action_id_seq OWNED BY public.mstr_nudge_action.id;


--
-- TOC entry 439 (class 1259 OID 27662359)
-- Name: mstr_nudge_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_nudge_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_nudge_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9092 (class 0 OID 0)
-- Dependencies: 439
-- Name: mstr_nudge_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_nudge_id_seq OWNED BY public.mstr_nudge.id;


--
-- TOC entry 440 (class 1259 OID 27662360)
-- Name: mstr_nudge_parameters; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_nudge_parameters (
    id integer NOT NULL,
    nudge_id integer,
    parameter character varying(255) NOT NULL,
    data_type character varying(50) NOT NULL,
    type character varying(50) NOT NULL,
    is_enable boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    created_by integer DEFAULT 1,
    updated_by integer
);


ALTER TABLE public.mstr_nudge_parameters OWNER TO nl2sql_ai;

--
-- TOC entry 441 (class 1259 OID 27662367)
-- Name: mstr_nudge_parameters_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_nudge_parameters_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_nudge_parameters_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9093 (class 0 OID 0)
-- Dependencies: 441
-- Name: mstr_nudge_parameters_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_nudge_parameters_id_seq OWNED BY public.mstr_nudge_parameters.id;


--
-- TOC entry 442 (class 1259 OID 27662368)
-- Name: mstr_nudge_scope; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_nudge_scope (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    description text,
    key character varying(255) NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    created_by integer DEFAULT 1,
    updated_by integer
);


ALTER TABLE public.mstr_nudge_scope OWNER TO nl2sql_ai;

--
-- TOC entry 443 (class 1259 OID 27662376)
-- Name: mstr_nudge_scope_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_nudge_scope_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_nudge_scope_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9094 (class 0 OID 0)
-- Dependencies: 443
-- Name: mstr_nudge_scope_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_nudge_scope_id_seq OWNED BY public.mstr_nudge_scope.id;


--
-- TOC entry 444 (class 1259 OID 27662377)
-- Name: mstr_nudge_scope_role_mapping; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_nudge_scope_role_mapping (
    id integer NOT NULL,
    nudge_id integer,
    scope_id integer,
    role_id integer NOT NULL,
    is_enable boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    created_by integer DEFAULT 1,
    updated_by integer
);


ALTER TABLE public.mstr_nudge_scope_role_mapping OWNER TO nl2sql_ai;

--
-- TOC entry 445 (class 1259 OID 27662384)
-- Name: mstr_nudge_scope_role_mapping_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_nudge_scope_role_mapping_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_nudge_scope_role_mapping_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9095 (class 0 OID 0)
-- Dependencies: 445
-- Name: mstr_nudge_scope_role_mapping_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_nudge_scope_role_mapping_id_seq OWNED BY public.mstr_nudge_scope_role_mapping.id;


--
-- TOC entry 446 (class 1259 OID 27662385)
-- Name: mstr_org_service_weightage; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_org_service_weightage (
    id integer NOT NULL,
    org_id integer NOT NULL,
    service_id integer NOT NULL,
    weightage_score numeric(10,4) DEFAULT 0 NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone
);


ALTER TABLE public.mstr_org_service_weightage OWNER TO nl2sql_ai;

--
-- TOC entry 447 (class 1259 OID 27662390)
-- Name: mstr_org_service_weightage_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_org_service_weightage_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_org_service_weightage_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9096 (class 0 OID 0)
-- Dependencies: 447
-- Name: mstr_org_service_weightage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_org_service_weightage_id_seq OWNED BY public.mstr_org_service_weightage.id;


--
-- TOC entry 448 (class 1259 OID 27662391)
-- Name: mstr_policy_constraints; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_policy_constraints (
    id integer NOT NULL,
    country_id integer NOT NULL,
    constraints jsonb NOT NULL,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.mstr_policy_constraints OWNER TO nl2sql_ai;

--
-- TOC entry 449 (class 1259 OID 27662398)
-- Name: mstr_policy_constraints_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_policy_constraints_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_policy_constraints_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9097 (class 0 OID 0)
-- Dependencies: 449
-- Name: mstr_policy_constraints_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_policy_constraints_id_seq OWNED BY public.mstr_policy_constraints.id;


--
-- TOC entry 450 (class 1259 OID 27662399)
-- Name: mstr_policy_endorsement_steps; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_policy_endorsement_steps (
    id integer NOT NULL,
    label character varying(100) NOT NULL,
    description text,
    endorsement_step_key character varying(100) NOT NULL,
    endorsement_step_value character varying(100) NOT NULL
);


ALTER TABLE public.mstr_policy_endorsement_steps OWNER TO nl2sql_ai;

--
-- TOC entry 451 (class 1259 OID 27662404)
-- Name: mstr_policy_endorsement_steps_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_policy_endorsement_steps_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_policy_endorsement_steps_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9098 (class 0 OID 0)
-- Dependencies: 451
-- Name: mstr_policy_endorsement_steps_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_policy_endorsement_steps_id_seq OWNED BY public.mstr_policy_endorsement_steps.id;


--
-- TOC entry 452 (class 1259 OID 27662405)
-- Name: mstr_policy_hospital_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_policy_hospital_map (
    id integer NOT NULL,
    policy_id integer NOT NULL,
    hospital_id integer NOT NULL,
    is_network_hospital boolean DEFAULT true NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_by integer NOT NULL,
    deleted_at timestamp with time zone,
    deleted_by integer
);


ALTER TABLE public.mstr_policy_hospital_map OWNER TO nl2sql_ai;

--
-- TOC entry 453 (class 1259 OID 27662411)
-- Name: mstr_policy_hospital_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_policy_hospital_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_policy_hospital_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9099 (class 0 OID 0)
-- Dependencies: 453
-- Name: mstr_policy_hospital_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_policy_hospital_map_id_seq OWNED BY public.mstr_policy_hospital_map.id;


--
-- TOC entry 454 (class 1259 OID 27662412)
-- Name: mstr_service; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_service (
    id integer NOT NULL,
    service_name character varying(150) NOT NULL,
    service_display_name character varying(150) NOT NULL,
    service_display_order integer DEFAULT 0 NOT NULL,
    status character varying(20) DEFAULT 'ACTIVE'::character varying NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone
);


ALTER TABLE public.mstr_service OWNER TO nl2sql_ai;

--
-- TOC entry 455 (class 1259 OID 27662418)
-- Name: mstr_service_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_service_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_service_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9100 (class 0 OID 0)
-- Dependencies: 455
-- Name: mstr_service_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_service_id_seq OWNED BY public.mstr_service.id;


--
-- TOC entry 226 (class 1259 OID 12820462)
-- Name: mstr_stage_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_stage_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.mstr_stage_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 456 (class 1259 OID 27662419)
-- Name: mstr_stage; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_stage (
    id integer DEFAULT nextval('public.mstr_stage_id_seq'::regclass) NOT NULL,
    name character varying(200) NOT NULL,
    description text,
    stage_meta jsonb,
    created_by integer DEFAULT 0 NOT NULL,
    updated_by integer DEFAULT 0 NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    stage_order integer,
    ref_role_key character varying(255),
    ro_name character varying(255)
);


ALTER TABLE public.mstr_stage OWNER TO nl2sql_ai;

--
-- TOC entry 227 (class 1259 OID 12820473)
-- Name: mstr_stage_activity_template_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_stage_activity_template_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.mstr_stage_activity_template_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 457 (class 1259 OID 27662429)
-- Name: mstr_stage_activity_template; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_stage_activity_template (
    id integer DEFAULT nextval('public.mstr_stage_activity_template_id_seq'::regclass) NOT NULL,
    policy_type_id integer NOT NULL,
    org_id integer NOT NULL,
    stage_id integer NOT NULL,
    activity_id integer NOT NULL,
    approval character varying(10) DEFAULT 'No'::character varying,
    mandatory character varying(10) DEFAULT 'Yes'::character varying,
    lead_role_id integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer DEFAULT 0 NOT NULL,
    updated_by integer DEFAULT 0 NOT NULL,
    opportunity_table character varying(100),
    stage_activity_order integer,
    activity_key character varying(100),
    ref_role_key character varying(255),
    stage_name character varying(200),
    activity_name character varying(200),
    lead_days integer,
    ro_stage_name character varying(255),
    ro_activity_name character varying(255)
);


ALTER TABLE public.mstr_stage_activity_template OWNER TO nl2sql_ai;

--
-- TOC entry 458 (class 1259 OID 27662441)
-- Name: mstr_tat_bucket; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.mstr_tat_bucket (
    id integer NOT NULL,
    org_id integer NOT NULL,
    tat_label character varying(50) NOT NULL,
    start_day integer NOT NULL,
    end_day integer NOT NULL,
    tat_display_order integer DEFAULT 0 NOT NULL,
    status character varying(20) DEFAULT 'ACTIVE'::character varying NOT NULL,
    tat_weight numeric(10,4) DEFAULT 0 NOT NULL,
    is_compliant boolean DEFAULT true NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone,
    CONSTRAINT chk_mstr_tat_bucket_day_range CHECK ((start_day <= end_day))
);


ALTER TABLE public.mstr_tat_bucket OWNER TO nl2sql_ai;

--
-- TOC entry 459 (class 1259 OID 27662450)
-- Name: mstr_tat_bucket_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.mstr_tat_bucket_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.mstr_tat_bucket_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9101 (class 0 OID 0)
-- Dependencies: 459
-- Name: mstr_tat_bucket_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.mstr_tat_bucket_id_seq OWNED BY public.mstr_tat_bucket.id;


--
-- TOC entry 460 (class 1259 OID 27662451)
-- Name: note; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.note (
    id integer NOT NULL,
    company_id integer,
    opportunity_id integer,
    activity_id integer,
    description text,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    title character varying(100) DEFAULT 'Untitled'::character varying NOT NULL
);


ALTER TABLE public.note OWNER TO nl2sql_ai;

--
-- TOC entry 461 (class 1259 OID 27662459)
-- Name: note_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.note_document_map (
    id integer NOT NULL,
    note_id integer NOT NULL,
    document_id integer NOT NULL
);


ALTER TABLE public.note_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 462 (class 1259 OID 27662462)
-- Name: note_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.note_document_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.note_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9102 (class 0 OID 0)
-- Dependencies: 462
-- Name: note_document_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.note_document_map_id_seq OWNED BY public.note_document_map.id;


--
-- TOC entry 463 (class 1259 OID 27662463)
-- Name: note_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.note_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.note_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9103 (class 0 OID 0)
-- Dependencies: 463
-- Name: note_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.note_id_seq OWNED BY public.note.id;


--
-- TOC entry 464 (class 1259 OID 27662464)
-- Name: notification_channel_event_template_mapping; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.notification_channel_event_template_mapping (
    id integer NOT NULL,
    subject text NOT NULL,
    body text NOT NULL,
    event_type_id integer NOT NULL,
    channel_type_id integer NOT NULL,
    status_lid integer,
    additional_user_id jsonb,
    additional_user_emails jsonb,
    created_by integer DEFAULT 0 NOT NULL,
    updated_by integer DEFAULT 0 NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


ALTER TABLE public.notification_channel_event_template_mapping OWNER TO nl2sql_ai;

--
-- TOC entry 465 (class 1259 OID 27662473)
-- Name: notification_channel_event_template_mapping_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.notification_channel_event_template_mapping_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.notification_channel_event_template_mapping_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9104 (class 0 OID 0)
-- Dependencies: 465
-- Name: notification_channel_event_template_mapping_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.notification_channel_event_template_mapping_id_seq OWNED BY public.notification_channel_event_template_mapping.id;


--
-- TOC entry 466 (class 1259 OID 27662474)
-- Name: notification_channel_type; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.notification_channel_type (
    id integer NOT NULL,
    channel_type_key character varying(50) NOT NULL,
    channel_type text NOT NULL,
    created_by integer DEFAULT 0 NOT NULL,
    updated_by integer DEFAULT 0 NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


ALTER TABLE public.notification_channel_type OWNER TO nl2sql_ai;

--
-- TOC entry 467 (class 1259 OID 27662483)
-- Name: notification_channel_type_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.notification_channel_type_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.notification_channel_type_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9105 (class 0 OID 0)
-- Dependencies: 467
-- Name: notification_channel_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.notification_channel_type_id_seq OWNED BY public.notification_channel_type.id;


--
-- TOC entry 468 (class 1259 OID 27662484)
-- Name: notification_event_template_mapping; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.notification_event_template_mapping (
    id integer NOT NULL,
    event_type_id integer NOT NULL,
    template_id integer NOT NULL,
    channel character varying(250) NOT NULL,
    status_lid integer
);


ALTER TABLE public.notification_event_template_mapping OWNER TO nl2sql_ai;

--
-- TOC entry 469 (class 1259 OID 27662487)
-- Name: notification_event_template_mapping_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.notification_event_template_mapping_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.notification_event_template_mapping_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9106 (class 0 OID 0)
-- Dependencies: 469
-- Name: notification_event_template_mapping_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.notification_event_template_mapping_id_seq OWNED BY public.notification_event_template_mapping.id;


--
-- TOC entry 470 (class 1259 OID 27662488)
-- Name: notification_event_type; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.notification_event_type (
    id integer NOT NULL,
    name character varying NOT NULL,
    description character varying
);


ALTER TABLE public.notification_event_type OWNER TO nl2sql_ai;

--
-- TOC entry 471 (class 1259 OID 27662493)
-- Name: notification_event_type_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.notification_event_type_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.notification_event_type_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9107 (class 0 OID 0)
-- Dependencies: 471
-- Name: notification_event_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.notification_event_type_id_seq OWNED BY public.notification_event_type.id;


--
-- TOC entry 472 (class 1259 OID 27662494)
-- Name: notification_in_app; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.notification_in_app (
    id integer NOT NULL,
    event_type_id integer NOT NULL,
    user_id integer NOT NULL,
    subject character varying NOT NULL,
    body text NOT NULL,
    status_lid integer DEFAULT 451,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    deleted_at timestamp with time zone,
    updated_at timestamp with time zone
);


ALTER TABLE public.notification_in_app OWNER TO nl2sql_ai;

--
-- TOC entry 473 (class 1259 OID 27662501)
-- Name: notification_in_app_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.notification_in_app_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.notification_in_app_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9108 (class 0 OID 0)
-- Dependencies: 473
-- Name: notification_in_app_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.notification_in_app_id_seq OWNED BY public.notification_in_app.id;


--
-- TOC entry 474 (class 1259 OID 27662502)
-- Name: notification_log; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.notification_log (
    id integer NOT NULL,
    event_type_id integer NOT NULL,
    error character varying,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    channel character varying(250) NOT NULL,
    status character varying(250) NOT NULL
);


ALTER TABLE public.notification_log OWNER TO nl2sql_ai;

--
-- TOC entry 475 (class 1259 OID 27662508)
-- Name: notification_log_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.notification_log_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.notification_log_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9109 (class 0 OID 0)
-- Dependencies: 475
-- Name: notification_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.notification_log_id_seq OWNED BY public.notification_log.id;


--
-- TOC entry 476 (class 1259 OID 27662509)
-- Name: notification_log_receiver_record; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.notification_log_receiver_record (
    id integer NOT NULL,
    log_id integer,
    receiver_email_id character varying,
    receiver_user_id integer
);


ALTER TABLE public.notification_log_receiver_record OWNER TO nl2sql_ai;

--
-- TOC entry 477 (class 1259 OID 27662514)
-- Name: notification_log_receiver_record_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.notification_log_receiver_record_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.notification_log_receiver_record_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9110 (class 0 OID 0)
-- Dependencies: 477
-- Name: notification_log_receiver_record_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.notification_log_receiver_record_id_seq OWNED BY public.notification_log_receiver_record.id;


--
-- TOC entry 478 (class 1259 OID 27662515)
-- Name: notification_parameter; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.notification_parameter (
    id integer NOT NULL,
    key character varying NOT NULL,
    description character varying
);


ALTER TABLE public.notification_parameter OWNER TO nl2sql_ai;

--
-- TOC entry 479 (class 1259 OID 27662520)
-- Name: notification_parameter_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.notification_parameter_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.notification_parameter_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9111 (class 0 OID 0)
-- Dependencies: 479
-- Name: notification_parameter_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.notification_parameter_id_seq OWNED BY public.notification_parameter.id;


--
-- TOC entry 480 (class 1259 OID 27662521)
-- Name: notification_template; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.notification_template (
    id integer NOT NULL,
    subject character varying NOT NULL,
    body text NOT NULL
);


ALTER TABLE public.notification_template OWNER TO nl2sql_ai;

--
-- TOC entry 481 (class 1259 OID 27662526)
-- Name: notification_template_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.notification_template_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.notification_template_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9112 (class 0 OID 0)
-- Dependencies: 481
-- Name: notification_template_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.notification_template_id_seq OWNED BY public.notification_template.id;


--
-- TOC entry 482 (class 1259 OID 27662527)
-- Name: opportunity; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity (
    id integer NOT NULL,
    company_id integer NOT NULL,
    contact_id integer,
    estimated_brokerage double precision,
    policy_type_lid integer NOT NULL,
    policy_status_lid integer NOT NULL,
    service_level_lid integer NOT NULL,
    expiry_date date NOT NULL,
    sum_insured double precision,
    premium_paid double precision,
    sharing_percentage double precision,
    estimated_fee double precision,
    prev_insurer_id integer,
    prev_insurer_location_id integer,
    prev_insurer_branch_id integer,
    prev_tpa_id integer,
    prev_tpa_location_id integer,
    prev_tpa_branch_id integer,
    remarks text,
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    deleted_at timestamp with time zone,
    opportunity_type_lid integer,
    is_policy_mined_lid integer,
    source_type_lid integer,
    source character varying(255),
    sales_pitch text,
    status_lid integer,
    owner_id integer,
    audit_ref_id integer,
    ref_policy_id integer,
    estimated_brokerage_percentage numeric(5,2),
    ref_opportunity_id integer,
    am_id integer,
    isg_id integer,
    injected_by character varying(100)
);


ALTER TABLE public.opportunity OWNER TO nl2sql_ai;

--
-- TOC entry 228 (class 1259 OID 12820569)
-- Name: opportunity_activity_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_activity_map_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.opportunity_activity_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 483 (class 1259 OID 27662534)
-- Name: opportunity_activity_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_activity_map (
    id integer DEFAULT nextval('public.opportunity_activity_map_id_seq'::regclass) NOT NULL,
    opportunity_id integer NOT NULL,
    ref_stage_id integer NOT NULL,
    ref_activity_id integer NOT NULL,
    activity_name character varying(200),
    stage_name character varying(200),
    original_due_date timestamp with time zone,
    lead_days integer,
    approval character varying(10) DEFAULT 'No'::character varying,
    mandatory character varying(10) DEFAULT 'Yes'::character varying,
    lead_role_id integer,
    activity_meta jsonb,
    due_date timestamp with time zone,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer DEFAULT 0 NOT NULL,
    updated_by integer DEFAULT 0 NOT NULL,
    opportunity_table character varying(100),
    status_lid integer,
    activity_key character varying(100),
    ref_role_key character varying(255),
    owner_id integer,
    planned_at timestamp with time zone,
    completed_at timestamp with time zone,
    activity_order integer,
    file_path_url character varying(500),
    activity_status_key character varying(20)
);


ALTER TABLE public.opportunity_activity_map OWNER TO nl2sql_ai;

--
-- TOC entry 229 (class 1259 OID 12820582)
-- Name: oppty_activity_participants_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.oppty_activity_participants_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.oppty_activity_participants_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 484 (class 1259 OID 27662546)
-- Name: opportunity_activity_participants; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_activity_participants (
    id integer DEFAULT nextval('public.oppty_activity_participants_id_seq'::regclass) NOT NULL,
    opportunity_id integer NOT NULL,
    activity_id integer NOT NULL,
    participant_id integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    created_by integer,
    updated_by integer,
    opportunity_activity_id integer
);


ALTER TABLE public.opportunity_activity_participants OWNER TO nl2sql_ai;

--
-- TOC entry 485 (class 1259 OID 27662552)
-- Name: opportunity_broking_slip_activity_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_broking_slip_activity_document_map (
    id integer NOT NULL,
    opportunity_activity_map_id integer NOT NULL,
    opportunity_id integer NOT NULL,
    document_id integer NOT NULL,
    document_type_lid integer NOT NULL
);


ALTER TABLE public.opportunity_broking_slip_activity_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 486 (class 1259 OID 27662555)
-- Name: opportunity_broking_slip_activity_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_broking_slip_activity_document_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_broking_slip_activity_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9113 (class 0 OID 0)
-- Dependencies: 486
-- Name: opportunity_broking_slip_activity_document_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_broking_slip_activity_document_map_id_seq OWNED BY public.opportunity_broking_slip_activity_document_map.id;


--
-- TOC entry 487 (class 1259 OID 27662556)
-- Name: opportunity_broking_slip_document_map_details; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_broking_slip_document_map_details (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    document_id integer NOT NULL
);


ALTER TABLE public.opportunity_broking_slip_document_map_details OWNER TO nl2sql_ai;

--
-- TOC entry 488 (class 1259 OID 27662559)
-- Name: opportunity_broking_slip_document_map_details_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_broking_slip_document_map_details_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_broking_slip_document_map_details_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9114 (class 0 OID 0)
-- Dependencies: 488
-- Name: opportunity_broking_slip_document_map_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_broking_slip_document_map_details_id_seq OWNED BY public.opportunity_broking_slip_document_map_details.id;


--
-- TOC entry 489 (class 1259 OID 27662560)
-- Name: opportunity_broking_slip_version_cover_map_details; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_broking_slip_version_cover_map_details (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    cover_map_id integer NOT NULL,
    policy_type_id integer NOT NULL,
    broking_slip_version_id integer NOT NULL,
    cover_name text NOT NULL,
    cover_response text NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    created_by integer NOT NULL,
    updated_by integer NOT NULL
);


ALTER TABLE public.opportunity_broking_slip_version_cover_map_details OWNER TO nl2sql_ai;

--
-- TOC entry 490 (class 1259 OID 27662567)
-- Name: opportunity_broking_slip_version_cover_map_details_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_broking_slip_version_cover_map_details_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_broking_slip_version_cover_map_details_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9115 (class 0 OID 0)
-- Dependencies: 490
-- Name: opportunity_broking_slip_version_cover_map_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_broking_slip_version_cover_map_details_id_seq OWNED BY public.opportunity_broking_slip_version_cover_map_details.id;


--
-- TOC entry 491 (class 1259 OID 27662568)
-- Name: opportunity_broking_slip_version_details; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_broking_slip_version_details (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    sum_insured numeric NOT NULL,
    brokerage_percentage numeric,
    policy_from date NOT NULL,
    policy_to date NOT NULL,
    renewal_date date NOT NULL,
    quote_receipt_timeline date NOT NULL,
    business_activity text,
    risk_mitigation_features text,
    clauses text,
    insurer_remarks text,
    remarks text,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    broking_slip_version integer NOT NULL,
    broking_slip_name text NOT NULL,
    basic_premium numeric(19,2),
    brokerage_amount numeric(19,2)
);


ALTER TABLE public.opportunity_broking_slip_version_details OWNER TO nl2sql_ai;

--
-- TOC entry 492 (class 1259 OID 27662575)
-- Name: opportunity_broking_slip_version_details_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_broking_slip_version_details_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_broking_slip_version_details_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9116 (class 0 OID 0)
-- Dependencies: 492
-- Name: opportunity_broking_slip_version_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_broking_slip_version_details_id_seq OWNED BY public.opportunity_broking_slip_version_details.id;


--
-- TOC entry 493 (class 1259 OID 27662576)
-- Name: opportunity_challenges; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_challenges (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    challenge_type_lid integer NOT NULL,
    description text,
    mitigation_type_lid integer NOT NULL,
    mitigation_description text
);


ALTER TABLE public.opportunity_challenges OWNER TO nl2sql_ai;

--
-- TOC entry 494 (class 1259 OID 27662581)
-- Name: opportunity_challenges_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_challenges_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_challenges_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9117 (class 0 OID 0)
-- Dependencies: 494
-- Name: opportunity_challenges_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_challenges_id_seq OWNED BY public.opportunity_challenges.id;


--
-- TOC entry 495 (class 1259 OID 27662582)
-- Name: opportunity_claim_experience; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_claim_experience (
    id integer NOT NULL,
    opportunity_id integer,
    policy_from date,
    policy_to date,
    nature_of_loss character varying(255),
    premium double precision,
    claim_amount double precision,
    claim_percentage double precision,
    remarks text
);


ALTER TABLE public.opportunity_claim_experience OWNER TO nl2sql_ai;

--
-- TOC entry 496 (class 1259 OID 27662587)
-- Name: opportunity_claim_experience_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_claim_experience_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_claim_experience_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9118 (class 0 OID 0)
-- Dependencies: 496
-- Name: opportunity_claim_experience_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_claim_experience_id_seq OWNED BY public.opportunity_claim_experience.id;


--
-- TOC entry 497 (class 1259 OID 27662588)
-- Name: opportunity_competitor; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_competitor (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    competitor character varying(255) NOT NULL,
    competitor_id integer,
    competitor_branch_id integer
);


ALTER TABLE public.opportunity_competitor OWNER TO nl2sql_ai;

--
-- TOC entry 498 (class 1259 OID 27662591)
-- Name: opportunity_competitor_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_competitor_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_competitor_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9119 (class 0 OID 0)
-- Dependencies: 498
-- Name: opportunity_competitor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_competitor_id_seq OWNED BY public.opportunity_competitor.id;


--
-- TOC entry 499 (class 1259 OID 27662592)
-- Name: opportunity_contact_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_contact_map (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    contact_id integer NOT NULL
);


ALTER TABLE public.opportunity_contact_map OWNER TO nl2sql_ai;

--
-- TOC entry 500 (class 1259 OID 27662595)
-- Name: opportunity_contact_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_contact_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_contact_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9120 (class 0 OID 0)
-- Dependencies: 500
-- Name: opportunity_contact_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_contact_map_id_seq OWNED BY public.opportunity_contact_map.id;


--
-- TOC entry 230 (class 1259 OID 12820633)
-- Name: opportunity_cover_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_cover_map_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    MAXVALUE 2147483647
    CACHE 1;


ALTER SEQUENCE public.opportunity_cover_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 501 (class 1259 OID 27662596)
-- Name: opportunity_cover_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_cover_map (
    id integer DEFAULT nextval('public.opportunity_cover_map_id_seq'::regclass) NOT NULL,
    opportunity_id integer NOT NULL,
    policy_type_id integer NOT NULL,
    cover_id integer NOT NULL,
    mandate_type character varying(50) NOT NULL,
    approval_required character varying(10) DEFAULT 'No'::character varying,
    cover_name text,
    cover_description text,
    display_sequence integer,
    display_category character varying(100),
    cover_type integer,
    input_type character varying(100),
    input_lov jsonb,
    covers_meta jsonb,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


ALTER TABLE public.opportunity_cover_map OWNER TO nl2sql_ai;

--
-- TOC entry 502 (class 1259 OID 27662605)
-- Name: opportunity_data_validation; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_data_validation (
    id integer DEFAULT nextval('public.data_validation_id_seq'::regclass) NOT NULL,
    opportunity_id integer,
    activity_id integer,
    plan_date date DEFAULT CURRENT_DATE,
    perform_date date,
    description text,
    activity_type_lid integer,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    status_lid integer,
    task_id integer,
    opportunity_activity_id integer
);


ALTER TABLE public.opportunity_data_validation OWNER TO nl2sql_ai;

--
-- TOC entry 503 (class 1259 OID 27662614)
-- Name: opportunity_data_validation_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_data_validation_document_map (
    id integer NOT NULL,
    data_validation_id integer NOT NULL,
    document_id integer NOT NULL,
    task_id integer,
    document_type_lid integer NOT NULL
);


ALTER TABLE public.opportunity_data_validation_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 504 (class 1259 OID 27662617)
-- Name: opportunity_data_validation_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_data_validation_document_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_data_validation_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9121 (class 0 OID 0)
-- Dependencies: 504
-- Name: opportunity_data_validation_document_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_data_validation_document_map_id_seq OWNED BY public.opportunity_data_validation_document_map.id;


--
-- TOC entry 505 (class 1259 OID 27662618)
-- Name: opportunity_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_document_map (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    document_id integer NOT NULL
);


ALTER TABLE public.opportunity_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 506 (class 1259 OID 27662621)
-- Name: opportunity_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_document_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9122 (class 0 OID 0)
-- Dependencies: 506
-- Name: opportunity_document_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_document_map_id_seq OWNED BY public.opportunity_document_map.id;


--
-- TOC entry 507 (class 1259 OID 27662622)
-- Name: opportunity_final_negotiation; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_final_negotiation (
    id integer NOT NULL,
    meeting_id integer,
    policy_placed_type_lid integer,
    lead_insurer_id integer,
    is_lead_insurer_pay_commission_lid integer,
    finalized_quote_id integer,
    is_quote_edited integer,
    basic_premium numeric,
    terrorism numeric,
    net_premium numeric,
    basic_brokerage_percentage numeric,
    insurer_remarks text,
    remarks text,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    created_by integer,
    updated_by integer,
    opportunity_id integer,
    activity_id integer,
    opportunity_activity_id integer,
    other_insurer_comments text,
    status_lid integer,
    is_final_negotiation_lid integer NOT NULL,
    select_meeting_id integer,
    quote_received_on timestamp with time zone,
    min_of_meeting text,
    quote_insurer_id integer,
    finalized_version_id integer,
    quote_insurer_location_id integer,
    basic_premium_percentage numeric(5,2),
    srcc_percentage numeric(5,2),
    srcc_amount numeric(19,2),
    terrorism_brokerage_percentage numeric(5,2),
    gst_percentage numeric(5,2),
    gst_amount numeric(19,2),
    total_gross_premium_inc_tax numeric(19,2),
    fee_percentage numeric(5,2),
    fee numeric(19,2),
    other_percentage numeric(5,2),
    other numeric(19,2),
    admin_charges_percentage numeric(5,2),
    admin_charges numeric(19,2),
    cess_percentage numeric(5,2),
    cess_amount numeric(19,2),
    gross_premium numeric(19,2),
    tc_brokerage_amount numeric(19,2),
    basic_brokerage_amount numeric(19,2),
    srcc_brokerage_amount numeric(19,2),
    brokerage_amount numeric(19,2),
    meeting_date date,
    start_time time with time zone,
    end_time time with time zone,
    location_type_lid integer,
    total_brokerage_amount numeric(19,2)
);


ALTER TABLE public.opportunity_final_negotiation OWNER TO nl2sql_ai;

--
-- TOC entry 508 (class 1259 OID 27662629)
-- Name: opportunity_final_negotiation_doc_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_final_negotiation_doc_map (
    id integer NOT NULL,
    opportunity_final_negotiation_id integer,
    document_id integer,
    document_type_lid integer
);


ALTER TABLE public.opportunity_final_negotiation_doc_map OWNER TO nl2sql_ai;

--
-- TOC entry 509 (class 1259 OID 27662632)
-- Name: opportunity_final_negotiation_doc_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_final_negotiation_doc_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_final_negotiation_doc_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9123 (class 0 OID 0)
-- Dependencies: 509
-- Name: opportunity_final_negotiation_doc_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_final_negotiation_doc_map_id_seq OWNED BY public.opportunity_final_negotiation_doc_map.id;


--
-- TOC entry 510 (class 1259 OID 27662633)
-- Name: opportunity_final_negotiation_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_final_negotiation_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_final_negotiation_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9124 (class 0 OID 0)
-- Dependencies: 510
-- Name: opportunity_final_negotiation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_final_negotiation_id_seq OWNED BY public.opportunity_final_negotiation.id;


--
-- TOC entry 511 (class 1259 OID 27662634)
-- Name: opportunity_final_negotiation_qcr_variation; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_final_negotiation_qcr_variation (
    id integer NOT NULL,
    opportunity_final_negotiation_id integer,
    issue character varying(255)
);


ALTER TABLE public.opportunity_final_negotiation_qcr_variation OWNER TO nl2sql_ai;

--
-- TOC entry 512 (class 1259 OID 27662637)
-- Name: opportunity_final_negotiation_qcr_variation_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_final_negotiation_qcr_variation_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_final_negotiation_qcr_variation_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9125 (class 0 OID 0)
-- Dependencies: 512
-- Name: opportunity_final_negotiation_qcr_variation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_final_negotiation_qcr_variation_id_seq OWNED BY public.opportunity_final_negotiation_qcr_variation.id;


--
-- TOC entry 513 (class 1259 OID 27662638)
-- Name: opportunity_final_negotiation_quote_cover_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_final_negotiation_quote_cover_detail (
    id integer NOT NULL,
    opportunity_final_negotiation_id integer NOT NULL,
    quote_id integer,
    cover_map_id integer NOT NULL,
    insurer_cover_response text,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    opportunity_id integer
);


ALTER TABLE public.opportunity_final_negotiation_quote_cover_detail OWNER TO nl2sql_ai;

--
-- TOC entry 514 (class 1259 OID 27662645)
-- Name: opportunity_final_negotiation_quote_cover_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_final_negotiation_quote_cover_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_final_negotiation_quote_cover_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9126 (class 0 OID 0)
-- Dependencies: 514
-- Name: opportunity_final_negotiation_quote_cover_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_final_negotiation_quote_cover_detail_id_seq OWNED BY public.opportunity_final_negotiation_quote_cover_detail.id;


--
-- TOC entry 515 (class 1259 OID 27662646)
-- Name: opportunity_final_negotiation_quote_documents; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_final_negotiation_quote_documents (
    id integer NOT NULL,
    opportunity_final_negotiation_id integer NOT NULL,
    quote_id integer NOT NULL,
    document_id integer NOT NULL,
    document_type_lid integer NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.opportunity_final_negotiation_quote_documents OWNER TO nl2sql_ai;

--
-- TOC entry 516 (class 1259 OID 27662651)
-- Name: opportunity_final_negotiation_quote_documents_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_final_negotiation_quote_documents_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_final_negotiation_quote_documents_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9127 (class 0 OID 0)
-- Dependencies: 516
-- Name: opportunity_final_negotiation_quote_documents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_final_negotiation_quote_documents_id_seq OWNED BY public.opportunity_final_negotiation_quote_documents.id;


--
-- TOC entry 517 (class 1259 OID 27662652)
-- Name: opportunity_final_negotiation_service_level_agreement; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_final_negotiation_service_level_agreement (
    id integer NOT NULL,
    opportunity_final_negotiation_id integer,
    service_type_id integer,
    number_of_days integer
);


ALTER TABLE public.opportunity_final_negotiation_service_level_agreement OWNER TO nl2sql_ai;

--
-- TOC entry 518 (class 1259 OID 27662655)
-- Name: opportunity_final_negotiation_service_level_agreement_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_final_negotiation_service_level_agreement_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_final_negotiation_service_level_agreement_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9128 (class 0 OID 0)
-- Dependencies: 518
-- Name: opportunity_final_negotiation_service_level_agreement_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_final_negotiation_service_level_agreement_id_seq OWNED BY public.opportunity_final_negotiation_service_level_agreement.id;


--
-- TOC entry 519 (class 1259 OID 27662656)
-- Name: opportunity_final_negotiation_sharing_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_final_negotiation_sharing_detail (
    id integer NOT NULL,
    opportunity_final_negotiation_id integer,
    insurer_id integer,
    share_percentage numeric,
    brokerage_percentage numeric,
    brokerage_amount numeric,
    share_amount numeric(19,2),
    insurer_location_id integer,
    insurer_branch_id integer,
    insurer_contact_id integer,
    is_lead_insurer integer,
    terrorism_brokerage_percentage numeric(5,2),
    terrorism_brokerage_amount numeric(19,2),
    total_brokerage_amount numeric(19,2)
);


ALTER TABLE public.opportunity_final_negotiation_sharing_detail OWNER TO nl2sql_ai;

--
-- TOC entry 520 (class 1259 OID 27662661)
-- Name: opportunity_final_negotiation_sharing_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_final_negotiation_sharing_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_final_negotiation_sharing_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9129 (class 0 OID 0)
-- Dependencies: 520
-- Name: opportunity_final_negotiation_sharing_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_final_negotiation_sharing_detail_id_seq OWNED BY public.opportunity_final_negotiation_sharing_detail.id;


--
-- TOC entry 521 (class 1259 OID 27662662)
-- Name: opportunity_final_negotiation_tax_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_final_negotiation_tax_map (
    id integer NOT NULL,
    opportunity_final_negotiation_id integer,
    tax integer,
    tax_value integer
);


ALTER TABLE public.opportunity_final_negotiation_tax_map OWNER TO nl2sql_ai;

--
-- TOC entry 522 (class 1259 OID 27662665)
-- Name: opportunity_final_negotiation_tax_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_final_negotiation_tax_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_final_negotiation_tax_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9130 (class 0 OID 0)
-- Dependencies: 522
-- Name: opportunity_final_negotiation_tax_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_final_negotiation_tax_map_id_seq OWNED BY public.opportunity_final_negotiation_tax_map.id;


--
-- TOC entry 523 (class 1259 OID 27662666)
-- Name: opportunity_hand_over_meet; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_hand_over_meet (
    id integer NOT NULL,
    activity_id integer NOT NULL,
    opportunity_id integer NOT NULL,
    opportunity_activity_id integer NOT NULL,
    remarks text,
    meeting_id integer,
    status_lid integer,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    hand_over_meeting_type_lid integer NOT NULL,
    select_meeting_id integer,
    mom text,
    meeting_date date,
    start_time time with time zone,
    end_time time with time zone,
    location_type_lid integer
);


ALTER TABLE public.opportunity_hand_over_meet OWNER TO nl2sql_ai;

--
-- TOC entry 524 (class 1259 OID 27662673)
-- Name: opportunity_hand_over_meet_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_hand_over_meet_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_hand_over_meet_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9131 (class 0 OID 0)
-- Dependencies: 524
-- Name: opportunity_hand_over_meet_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_hand_over_meet_id_seq OWNED BY public.opportunity_hand_over_meet.id;


--
-- TOC entry 525 (class 1259 OID 27662674)
-- Name: opportunity_held_cover_note; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_held_cover_note (
    id integer NOT NULL,
    opportunity_id integer,
    activity_id integer,
    opportunity_activity_id integer,
    status_lid integer,
    placement_slip_deviations_lid integer,
    deviations character varying(500),
    deviations_addressed_lid integer,
    revised_held_cover_note_lid integer,
    resolution_lid integer,
    acknowledged_by integer,
    receipt_no character varying(255),
    receipt_date timestamp with time zone,
    all_documents_received_date timestamp with time zone,
    remarks character varying(1000),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    basic_brokerage_percentage numeric(5,2),
    brokerage_amount numeric(19,2),
    basic_premium_percentage numeric(5,2),
    basic_premium numeric(19,2),
    srcc_percentage numeric(5,2),
    srcc_amount numeric(19,2),
    terrorism_brokerage_percentage numeric(5,2),
    terrorism numeric(19,2),
    gst_percentage numeric(5,2),
    gst_amount numeric(19,2),
    net_premium numeric(19,2),
    total_gross_premium_inc_tax numeric(19,2),
    fee_percentage numeric(5,2),
    fee numeric(19,2),
    other_percentage numeric(5,2),
    other numeric(19,2),
    admin_charges_percentage numeric(5,2),
    admin_charges numeric(19,2),
    cess_percentage numeric(5,2),
    cess_amount numeric(19,2),
    gross_premium numeric(19,2),
    tc_brokerage_amount numeric(19,2),
    basic_brokerage_amount numeric(19,2),
    srcc_brokerage_amount numeric(19,2),
    sum_insured numeric(19,2),
    total_premium numeric(19,2),
    lead_insurer_id integer,
    is_lead_insurer_pay_commission integer,
    policy_placed_type_lid integer,
    total_brokerage_amount numeric(19,2)
);


ALTER TABLE public.opportunity_held_cover_note OWNER TO nl2sql_ai;

--
-- TOC entry 526 (class 1259 OID 27662681)
-- Name: opportunity_held_cover_note_cover_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_held_cover_note_cover_detail (
    id integer NOT NULL,
    held_cover_note_id integer NOT NULL,
    opportunity_id integer NOT NULL,
    cover_template_id integer NOT NULL,
    cover_name character varying NOT NULL,
    cover_response character varying,
    covers_meta jsonb,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.opportunity_held_cover_note_cover_detail OWNER TO nl2sql_ai;

--
-- TOC entry 527 (class 1259 OID 27662688)
-- Name: opportunity_held_cover_note_cover_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_held_cover_note_cover_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_held_cover_note_cover_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9132 (class 0 OID 0)
-- Dependencies: 527
-- Name: opportunity_held_cover_note_cover_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_held_cover_note_cover_detail_id_seq OWNED BY public.opportunity_held_cover_note_cover_detail.id;


--
-- TOC entry 528 (class 1259 OID 27662689)
-- Name: opportunity_held_cover_note_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_held_cover_note_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_held_cover_note_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9133 (class 0 OID 0)
-- Dependencies: 528
-- Name: opportunity_held_cover_note_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_held_cover_note_id_seq OWNED BY public.opportunity_held_cover_note.id;


--
-- TOC entry 529 (class 1259 OID 27662690)
-- Name: opportunity_held_cover_note_insurer_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_held_cover_note_insurer_map (
    id integer NOT NULL,
    held_cover_note_id integer NOT NULL,
    insurer_id integer NOT NULL,
    insurer_location_id integer NOT NULL,
    insurer_branch_id integer NOT NULL,
    insurer_contact_id integer NOT NULL,
    is_lead_insurer integer,
    share_percentage numeric(5,2) NOT NULL,
    share_amount numeric(19,2) NOT NULL,
    brokerage_percentage numeric(5,2) NOT NULL,
    brokerage_amount numeric(19,2) NOT NULL,
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    deleted_at timestamp with time zone,
    terrorism_brokerage_percentage numeric(5,2),
    terrorism_brokerage_amount numeric(19,2),
    total_brokerage_amount numeric(19,2)
);


ALTER TABLE public.opportunity_held_cover_note_insurer_map OWNER TO nl2sql_ai;

--
-- TOC entry 530 (class 1259 OID 27662693)
-- Name: opportunity_held_cover_note_insurer_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_held_cover_note_insurer_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_held_cover_note_insurer_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9134 (class 0 OID 0)
-- Dependencies: 530
-- Name: opportunity_held_cover_note_insurer_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_held_cover_note_insurer_map_id_seq OWNED BY public.opportunity_held_cover_note_insurer_map.id;


--
-- TOC entry 531 (class 1259 OID 27662694)
-- Name: opportunity_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9135 (class 0 OID 0)
-- Dependencies: 531
-- Name: opportunity_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_id_seq OWNED BY public.opportunity.id;


--
-- TOC entry 532 (class 1259 OID 27662695)
-- Name: opportunity_kdm_meeting; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_kdm_meeting (
    id integer NOT NULL,
    meeting_id integer,
    status_lid integer,
    remarks text,
    opportunity_id integer NOT NULL,
    activity_id integer NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    kdm_meeting_type_lid integer,
    select_meeting_id integer,
    mom text,
    opportunity_activity_id integer,
    meeting_date date,
    start_time time with time zone,
    end_time time with time zone,
    location_type_lid integer
);


ALTER TABLE public.opportunity_kdm_meeting OWNER TO nl2sql_ai;

--
-- TOC entry 533 (class 1259 OID 27662702)
-- Name: opportunity_kdm_meeting_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_kdm_meeting_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_kdm_meeting_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9136 (class 0 OID 0)
-- Dependencies: 533
-- Name: opportunity_kdm_meeting_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_kdm_meeting_id_seq OWNED BY public.opportunity_kdm_meeting.id;


--
-- TOC entry 534 (class 1259 OID 27662703)
-- Name: opportunity_lost; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_lost (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    activity_id integer,
    opportunity_activity_id integer,
    remarks text,
    reason_for_loss_lid integer,
    status_lid integer,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    injected_by character varying(100)
);


ALTER TABLE public.opportunity_lost OWNER TO nl2sql_ai;

--
-- TOC entry 535 (class 1259 OID 27662710)
-- Name: opportunity_lost_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_lost_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_lost_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9137 (class 0 OID 0)
-- Dependencies: 535
-- Name: opportunity_lost_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_lost_id_seq OWNED BY public.opportunity_lost.id;


--
-- TOC entry 536 (class 1259 OID 27662711)
-- Name: opportunity_mandate_details_contact_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_mandate_details_contact_map (
    id integer NOT NULL,
    mandate_id integer NOT NULL,
    contact_id integer NOT NULL
);


ALTER TABLE public.opportunity_mandate_details_contact_map OWNER TO nl2sql_ai;

--
-- TOC entry 537 (class 1259 OID 27662714)
-- Name: opportunity_mandate_details_contact_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_mandate_details_contact_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_mandate_details_contact_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9138 (class 0 OID 0)
-- Dependencies: 537
-- Name: opportunity_mandate_details_contact_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_mandate_details_contact_map_id_seq OWNED BY public.opportunity_mandate_details_contact_map.id;


--
-- TOC entry 538 (class 1259 OID 27662715)
-- Name: opportunity_mandate_details_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_mandate_details_document_map (
    id integer NOT NULL,
    mandate_id integer NOT NULL,
    document_type_lid integer NOT NULL,
    document_id integer NOT NULL
);


ALTER TABLE public.opportunity_mandate_details_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 539 (class 1259 OID 27662718)
-- Name: opportunity_mandate_details_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_mandate_details_document_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_mandate_details_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9139 (class 0 OID 0)
-- Dependencies: 539
-- Name: opportunity_mandate_details_document_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_mandate_details_document_map_id_seq OWNED BY public.opportunity_mandate_details_document_map.id;


--
-- TOC entry 540 (class 1259 OID 27662719)
-- Name: opportunity_mandate_details_entry; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_mandate_details_entry (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    activity_id integer NOT NULL,
    company_id integer,
    activity_date date DEFAULT CURRENT_DATE,
    plan_date date,
    mandate_type_lid integer,
    valid_from date,
    valid_to date,
    compensation_payable numeric(15,2),
    compensation_type_lid integer,
    issued_on date,
    remarks text,
    created_at timestamp without time zone DEFAULT now(),
    updated_at timestamp without time zone DEFAULT now(),
    created_by integer,
    updated_by integer,
    status_lid integer,
    opportunity_activity_id integer
);


ALTER TABLE public.opportunity_mandate_details_entry OWNER TO nl2sql_ai;

--
-- TOC entry 541 (class 1259 OID 27662727)
-- Name: opportunity_mandate_details_entry_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_mandate_details_entry_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_mandate_details_entry_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9140 (class 0 OID 0)
-- Dependencies: 541
-- Name: opportunity_mandate_details_entry_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_mandate_details_entry_id_seq OWNED BY public.opportunity_mandate_details_entry.id;


--
-- TOC entry 542 (class 1259 OID 27662728)
-- Name: opportunity_meeting_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_meeting_document_map (
    id integer NOT NULL,
    opportunity_activity_id integer NOT NULL,
    document_id integer NOT NULL,
    document_type_lid integer
);


ALTER TABLE public.opportunity_meeting_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 543 (class 1259 OID 27662731)
-- Name: opportunity_meeting_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_meeting_document_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_meeting_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9141 (class 0 OID 0)
-- Dependencies: 543
-- Name: opportunity_meeting_document_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_meeting_document_map_id_seq OWNED BY public.opportunity_meeting_document_map.id;


--
-- TOC entry 544 (class 1259 OID 27662732)
-- Name: opportunity_meeting_participant_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_meeting_participant_map (
    id integer NOT NULL,
    opportunity_activity_id integer NOT NULL,
    participant_id integer NOT NULL,
    participant_company_id integer NOT NULL,
    participant_record_type character varying(25),
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    CONSTRAINT opportunity_meeting_participant_m_participant_record_type_check CHECK (((participant_record_type)::text = ANY (ARRAY[('TPA_CONTACT'::character varying)::text, ('INSURER_CONTACT'::character varying)::text, ('BROKER_CONTACT'::character varying)::text, ('COMPANY_CONTACT'::character varying)::text, ('EMPLOYEE'::character varying)::text])))
);


ALTER TABLE public.opportunity_meeting_participant_map OWNER TO nl2sql_ai;

--
-- TOC entry 545 (class 1259 OID 27662738)
-- Name: opportunity_meeting_participant_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_meeting_participant_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_meeting_participant_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9142 (class 0 OID 0)
-- Dependencies: 545
-- Name: opportunity_meeting_participant_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_meeting_participant_map_id_seq OWNED BY public.opportunity_meeting_participant_map.id;


--
-- TOC entry 546 (class 1259 OID 27662739)
-- Name: opportunity_placement_slip_cd_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_placement_slip_cd_detail (
    id integer NOT NULL,
    placement_slip_id integer NOT NULL,
    cd_account_type_lid integer,
    cheque_amount numeric(19,2),
    cheque_number character varying,
    bank_name character varying,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    payment_type_lid integer,
    transaction_type_lid integer,
    account_name character varying(100),
    open_balance numeric(19,2),
    select_cd_account numeric(10,2),
    cheque_date date,
    deleted_at timestamp with time zone,
    account_number character varying(50)
);


ALTER TABLE public.opportunity_placement_slip_cd_detail OWNER TO nl2sql_ai;

--
-- TOC entry 547 (class 1259 OID 27662746)
-- Name: opportunity_placement_slip_cd_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_placement_slip_cd_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_placement_slip_cd_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9143 (class 0 OID 0)
-- Dependencies: 547
-- Name: opportunity_placement_slip_cd_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_placement_slip_cd_detail_id_seq OWNED BY public.opportunity_placement_slip_cd_detail.id;


--
-- TOC entry 548 (class 1259 OID 27662747)
-- Name: opportunity_placement_slip_cover_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_placement_slip_cover_detail (
    id integer NOT NULL,
    placement_slip_id integer NOT NULL,
    cover_template_id integer NOT NULL,
    cover_name character varying NOT NULL,
    cover_response character varying,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    opportunity_id integer,
    covers_meta jsonb
);


ALTER TABLE public.opportunity_placement_slip_cover_detail OWNER TO nl2sql_ai;

--
-- TOC entry 549 (class 1259 OID 27662754)
-- Name: opportunity_placement_slip_cover_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_placement_slip_cover_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_placement_slip_cover_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9144 (class 0 OID 0)
-- Dependencies: 549
-- Name: opportunity_placement_slip_cover_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_placement_slip_cover_detail_id_seq OWNED BY public.opportunity_placement_slip_cover_detail.id;


--
-- TOC entry 550 (class 1259 OID 27662755)
-- Name: opportunity_placement_slip_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_placement_slip_document_map (
    id integer NOT NULL,
    placement_slip_id integer NOT NULL,
    document_id integer NOT NULL,
    document_type_lid integer NOT NULL
);


ALTER TABLE public.opportunity_placement_slip_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 551 (class 1259 OID 27662758)
-- Name: opportunity_placement_slip_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_placement_slip_document_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_placement_slip_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9145 (class 0 OID 0)
-- Dependencies: 551
-- Name: opportunity_placement_slip_document_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_placement_slip_document_map_id_seq OWNED BY public.opportunity_placement_slip_document_map.id;


--
-- TOC entry 552 (class 1259 OID 27662759)
-- Name: opportunity_placement_slip_generation; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_placement_slip_generation (
    id integer NOT NULL,
    opportunity_activity_id integer NOT NULL,
    policy_from_date date,
    policy_to_date date,
    sum_insured numeric,
    basic_premium numeric,
    is_premium_installment_based integer,
    fee numeric,
    is_fee_in_installment integer,
    terrorism_brokerage_percentage numeric,
    gst_percentage numeric,
    gst_amount numeric,
    other numeric(19,2),
    total_premium numeric,
    lead_insurer_id integer,
    is_lead_insurer_pay_commission integer,
    placement_slip_date date,
    max_age_of_dependents integer,
    basic_brokerage_percentage numeric,
    policy_placed_type_lid integer,
    remarks character varying,
    status_lid integer NOT NULL,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    deleted_at timestamp with time zone,
    brokerage_amount numeric DEFAULT 0,
    basic_premium_percentage numeric(5,2),
    srcc_percentage numeric(5,2),
    srcc_amount numeric(19,2),
    terrorism numeric(19,2),
    total_gross_premium_inc_tax numeric(19,2),
    fee_percentage numeric(5,2),
    other_percentage numeric(5,2),
    admin_charges_percentage numeric(5,2),
    admin_charges numeric(19,2),
    cess_percentage numeric(5,2),
    cess_amount numeric(19,2),
    gross_premium numeric(19,2),
    tc_brokerage_amount numeric(19,2),
    basic_brokerage_amount numeric(19,2),
    srcc_brokerage_amount numeric(19,2),
    net_premium numeric(19,2),
    total_brokerage_amount numeric(19,2)
);


ALTER TABLE public.opportunity_placement_slip_generation OWNER TO nl2sql_ai;

--
-- TOC entry 553 (class 1259 OID 27662767)
-- Name: opportunity_placement_slip_generation_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_placement_slip_generation_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_placement_slip_generation_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9146 (class 0 OID 0)
-- Dependencies: 553
-- Name: opportunity_placement_slip_generation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_placement_slip_generation_id_seq OWNED BY public.opportunity_placement_slip_generation.id;


--
-- TOC entry 554 (class 1259 OID 27662768)
-- Name: opportunity_placement_slip_installement_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_placement_slip_installement_detail (
    id integer NOT NULL,
    placement_slip_id integer NOT NULL,
    first_installment_date date,
    second_installment_date date,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    installment_amount numeric,
    deleted_at timestamp with time zone
);


ALTER TABLE public.opportunity_placement_slip_installement_detail OWNER TO nl2sql_ai;

--
-- TOC entry 555 (class 1259 OID 27662775)
-- Name: opportunity_placement_slip_installement_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_placement_slip_installement_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_placement_slip_installement_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9147 (class 0 OID 0)
-- Dependencies: 555
-- Name: opportunity_placement_slip_installement_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_placement_slip_installement_detail_id_seq OWNED BY public.opportunity_placement_slip_installement_detail.id;


--
-- TOC entry 556 (class 1259 OID 27662776)
-- Name: opportunity_placement_slip_insurer_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_placement_slip_insurer_map (
    id integer NOT NULL,
    placement_slip_id integer NOT NULL,
    insurer_id integer NOT NULL,
    insurer_location_id integer NOT NULL,
    insurer_branch_id integer NOT NULL,
    insurer_contact_id integer NOT NULL,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    deleted_at timestamp with time zone,
    is_lead_insurer integer
);


ALTER TABLE public.opportunity_placement_slip_insurer_map OWNER TO nl2sql_ai;

--
-- TOC entry 557 (class 1259 OID 27662781)
-- Name: opportunity_placement_slip_insurer_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_placement_slip_insurer_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_placement_slip_insurer_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9148 (class 0 OID 0)
-- Dependencies: 557
-- Name: opportunity_placement_slip_insurer_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_placement_slip_insurer_map_id_seq OWNED BY public.opportunity_placement_slip_insurer_map.id;


--
-- TOC entry 558 (class 1259 OID 27662782)
-- Name: opportunity_placement_slip_sharing_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_placement_slip_sharing_detail (
    id integer NOT NULL,
    placement_slip_id integer NOT NULL,
    insurer_id integer NOT NULL,
    share_percentage numeric NOT NULL,
    brokerage_percentage numeric,
    brokerage_amount numeric,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    deleted_at timestamp with time zone,
    share_amount numeric,
    terrorism_brokerage_percentage numeric(5,2),
    terrorism_brokerage_amount numeric(19,2),
    total_brokerage_amount numeric(19,2)
);


ALTER TABLE public.opportunity_placement_slip_sharing_detail OWNER TO nl2sql_ai;

--
-- TOC entry 559 (class 1259 OID 27662789)
-- Name: opportunity_placement_slip_sharing_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_placement_slip_sharing_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_placement_slip_sharing_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9149 (class 0 OID 0)
-- Dependencies: 559
-- Name: opportunity_placement_slip_sharing_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_placement_slip_sharing_detail_id_seq OWNED BY public.opportunity_placement_slip_sharing_detail.id;


--
-- TOC entry 560 (class 1259 OID 27662790)
-- Name: opportunity_placement_slip_tpa_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_placement_slip_tpa_map (
    id integer NOT NULL,
    placement_slip_id integer NOT NULL,
    tpa_id integer,
    tpa_location_id integer,
    tpa_branch_id integer,
    tpa_contact_id integer,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    deleted_at timestamp with time zone
);


ALTER TABLE public.opportunity_placement_slip_tpa_map OWNER TO nl2sql_ai;

--
-- TOC entry 561 (class 1259 OID 27662795)
-- Name: opportunity_placement_slip_tpa_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_placement_slip_tpa_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_placement_slip_tpa_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9150 (class 0 OID 0)
-- Dependencies: 561
-- Name: opportunity_placement_slip_tpa_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_placement_slip_tpa_map_id_seq OWNED BY public.opportunity_placement_slip_tpa_map.id;


--
-- TOC entry 562 (class 1259 OID 27662796)
-- Name: opportunity_policy_confirmation; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_policy_confirmation (
    id integer NOT NULL,
    opportunity_id integer,
    activity_id integer,
    opportunity_activity_id integer,
    status_lid integer,
    policy_data_wrong_lid integer,
    deviation_resolved_lid integer,
    deviations character varying(500),
    resolution_lid integer,
    comments character varying(500),
    policy_data_rectified_lid integer,
    remarks character varying(500),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    basic_brokerage_percentage numeric(5,2),
    brokerage_amount numeric(19,2),
    basic_premium_percentage numeric(5,2),
    basic_premium numeric(19,2),
    srcc_percentage numeric(5,2),
    srcc_amount numeric(19,2),
    terrorism_brokerage_percentage numeric(5,2),
    terrorism numeric(19,2),
    gst_percentage numeric(5,2),
    gst_amount numeric(19,2),
    net_premium numeric(19,2),
    total_gross_premium_inc_tax numeric(19,2),
    fee_percentage numeric(5,2),
    fee numeric(19,2),
    other_percentage numeric(5,2),
    other numeric(19,2),
    admin_charges_percentage numeric(5,2),
    admin_charges numeric(19,2),
    cess_percentage numeric(5,2),
    cess_amount numeric(19,2),
    gross_premium numeric(19,2),
    tc_brokerage_amount numeric(19,2),
    basic_brokerage_amount numeric(19,2),
    srcc_brokerage_amount numeric(19,2),
    sum_insured numeric(19,2),
    total_premium numeric(19,2),
    lead_insurer_id integer,
    is_lead_insurer_pay_commission integer,
    policy_placed_type_lid integer,
    total_brokerage_amount numeric(19,2)
);


ALTER TABLE public.opportunity_policy_confirmation OWNER TO nl2sql_ai;

--
-- TOC entry 563 (class 1259 OID 27662803)
-- Name: opportunity_policy_confirmation_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_policy_confirmation_document_map (
    id integer NOT NULL,
    policy_confirmation_id integer NOT NULL,
    document_id integer NOT NULL,
    document_type_lid integer
);


ALTER TABLE public.opportunity_policy_confirmation_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 564 (class 1259 OID 27662806)
-- Name: opportunity_policy_confirmation_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_policy_confirmation_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_policy_confirmation_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9151 (class 0 OID 0)
-- Dependencies: 564
-- Name: opportunity_policy_confirmation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_policy_confirmation_id_seq OWNED BY public.opportunity_policy_confirmation.id;


--
-- TOC entry 565 (class 1259 OID 27662807)
-- Name: opportunity_policy_confirmation_insurer_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_policy_confirmation_insurer_map (
    id integer NOT NULL,
    policy_confirmation_id integer NOT NULL,
    insurer_id integer NOT NULL,
    insurer_location_id integer NOT NULL,
    insurer_branch_id integer NOT NULL,
    insurer_contact_id integer NOT NULL,
    is_lead_insurer integer,
    share_percentage numeric(5,2) NOT NULL,
    share_amount numeric(19,2) NOT NULL,
    brokerage_percentage numeric(5,2) NOT NULL,
    brokerage_amount numeric(19,2) NOT NULL,
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    deleted_at timestamp with time zone,
    terrorism_brokerage_percentage numeric(5,2),
    terrorism_brokerage_amount numeric(19,2),
    total_brokerage_amount numeric(19,2)
);


ALTER TABLE public.opportunity_policy_confirmation_insurer_map OWNER TO nl2sql_ai;

--
-- TOC entry 566 (class 1259 OID 27662810)
-- Name: opportunity_policy_confirmation_insurer_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_policy_confirmation_insurer_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_policy_confirmation_insurer_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9152 (class 0 OID 0)
-- Dependencies: 566
-- Name: opportunity_policy_confirmation_insurer_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_policy_confirmation_insurer_map_id_seq OWNED BY public.opportunity_policy_confirmation_insurer_map.id;


--
-- TOC entry 567 (class 1259 OID 27662811)
-- Name: opportunity_policy_docket; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_policy_docket (
    id integer NOT NULL,
    opportunity_id integer,
    activity_id integer,
    opportunity_activity_id integer,
    status_lid integer,
    issuance_date date,
    held_cover_note integer,
    policy_document integer,
    policy_docket integer,
    endorsement integer,
    health_claims integer,
    non_health_claims integer,
    mir integer,
    monthly_meeting integer,
    quarterly_meeting integer,
    renewal_notice integer,
    data_collection integer,
    remarks character varying(500),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.opportunity_policy_docket OWNER TO nl2sql_ai;

--
-- TOC entry 568 (class 1259 OID 27662818)
-- Name: opportunity_policy_docket_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_policy_docket_document_map (
    id integer NOT NULL,
    policy_docket_id integer NOT NULL,
    document_id integer NOT NULL,
    document_type_lid integer NOT NULL
);


ALTER TABLE public.opportunity_policy_docket_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 569 (class 1259 OID 27662821)
-- Name: opportunity_policy_docket_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_policy_docket_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_policy_docket_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9153 (class 0 OID 0)
-- Dependencies: 569
-- Name: opportunity_policy_docket_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_policy_docket_id_seq OWNED BY public.opportunity_policy_docket.id;


--
-- TOC entry 570 (class 1259 OID 27662822)
-- Name: opportunity_policy_hard_copy; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_policy_hard_copy (
    id integer NOT NULL,
    opportunity_id integer,
    activity_id integer,
    opportunity_activity_id integer,
    status_lid integer,
    insurer_policy_no character varying(100),
    hard_copy_received_on date,
    deviations_lid integer,
    basic_brokerage_percentage numeric(5,2),
    basic_premium integer,
    deviation_coverages_lid integer,
    coverages character varying(500),
    exclusions character varying(500),
    deductibles character varying(500),
    deviations_addressed_lid integer,
    resolution_lid integer,
    policy_hard_copy_received_lid integer,
    remarks character varying(500),
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    brokerage_amount numeric,
    basic_premium_percentage numeric(5,2),
    srcc_percentage numeric(5,2),
    srcc_amount numeric(19,2),
    terrorism_brokerage_percentage numeric(5,2),
    terrorism numeric(19,2),
    gst_percentage numeric(5,2),
    gst_amount numeric(19,2),
    net_premium numeric(19,2),
    total_gross_premium_inc_tax numeric(19,2),
    fee_percentage numeric(5,2),
    fee numeric(19,2),
    other_percentage numeric(5,2),
    other numeric(19,2),
    admin_charges_percentage numeric(5,2),
    admin_charges numeric(19,2),
    cess_percentage numeric(5,2),
    cess_amount numeric(19,2),
    gross_premium numeric(19,2),
    tc_brokerage_amount numeric(19,2),
    basic_brokerage_amount numeric(19,2),
    srcc_brokerage_amount numeric(19,2),
    sum_insured numeric(19,2),
    total_premium numeric(19,2),
    lead_insurer_id integer,
    is_lead_insurer_pay_commission integer,
    policy_placed_type_lid integer,
    total_brokerage_amount numeric(19,2)
);


ALTER TABLE public.opportunity_policy_hard_copy OWNER TO nl2sql_ai;

--
-- TOC entry 571 (class 1259 OID 27662829)
-- Name: opportunity_policy_hard_copy_cover_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_policy_hard_copy_cover_detail (
    id integer NOT NULL,
    policy_hard_copy_id integer NOT NULL,
    opportunity_id integer NOT NULL,
    cover_template_id integer NOT NULL,
    cover_name character varying NOT NULL,
    cover_response character varying,
    covers_meta jsonb,
    created_by integer NOT NULL,
    updated_by integer NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.opportunity_policy_hard_copy_cover_detail OWNER TO nl2sql_ai;

--
-- TOC entry 572 (class 1259 OID 27662836)
-- Name: opportunity_policy_hard_copy_cover_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_policy_hard_copy_cover_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_policy_hard_copy_cover_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9154 (class 0 OID 0)
-- Dependencies: 572
-- Name: opportunity_policy_hard_copy_cover_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_policy_hard_copy_cover_detail_id_seq OWNED BY public.opportunity_policy_hard_copy_cover_detail.id;


--
-- TOC entry 573 (class 1259 OID 27662837)
-- Name: opportunity_policy_hard_copy_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_policy_hard_copy_document_map (
    id integer NOT NULL,
    policy_hard_copy_id integer NOT NULL,
    document_id integer NOT NULL,
    document_type_lid integer NOT NULL
);


ALTER TABLE public.opportunity_policy_hard_copy_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 574 (class 1259 OID 27662840)
-- Name: opportunity_policy_hard_copy_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_policy_hard_copy_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_policy_hard_copy_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9155 (class 0 OID 0)
-- Dependencies: 574
-- Name: opportunity_policy_hard_copy_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_policy_hard_copy_id_seq OWNED BY public.opportunity_policy_hard_copy.id;


--
-- TOC entry 575 (class 1259 OID 27662841)
-- Name: opportunity_policy_hard_copy_insurer_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_policy_hard_copy_insurer_map (
    id integer NOT NULL,
    policy_hard_copy_id integer NOT NULL,
    insurer_id integer NOT NULL,
    insurer_location_id integer NOT NULL,
    insurer_branch_id integer NOT NULL,
    insurer_contact_id integer NOT NULL,
    is_lead_insurer integer,
    share_percentage numeric(5,2) NOT NULL,
    share_amount numeric(19,2) NOT NULL,
    brokerage_percentage numeric(5,2) NOT NULL,
    brokerage_amount numeric(19,2) NOT NULL,
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    deleted_at timestamp with time zone,
    terrorism_brokerage_percentage numeric(5,2),
    terrorism_brokerage_amount numeric(19,2),
    total_brokerage_amount numeric(19,2)
);


ALTER TABLE public.opportunity_policy_hard_copy_insurer_map OWNER TO nl2sql_ai;

--
-- TOC entry 576 (class 1259 OID 27662844)
-- Name: opportunity_policy_hard_copy_insurer_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_policy_hard_copy_insurer_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_policy_hard_copy_insurer_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9156 (class 0 OID 0)
-- Dependencies: 576
-- Name: opportunity_policy_hard_copy_insurer_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_policy_hard_copy_insurer_map_id_seq OWNED BY public.opportunity_policy_hard_copy_insurer_map.id;


--
-- TOC entry 577 (class 1259 OID 27662845)
-- Name: opportunity_premium_calculation; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_premium_calculation (
    id integer NOT NULL,
    opportunity_id integer,
    activity_id integer,
    opportunity_activity_id integer,
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    status_lid integer,
    remarks text
);


ALTER TABLE public.opportunity_premium_calculation OWNER TO nl2sql_ai;

--
-- TOC entry 578 (class 1259 OID 27662852)
-- Name: opportunity_premium_calculation_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_premium_calculation_document_map (
    id integer NOT NULL,
    opportunity_activity_id integer NOT NULL,
    document_id integer NOT NULL,
    document_type_lid integer NOT NULL
);


ALTER TABLE public.opportunity_premium_calculation_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 579 (class 1259 OID 27662855)
-- Name: opportunity_premium_calculation_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_premium_calculation_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_premium_calculation_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9157 (class 0 OID 0)
-- Dependencies: 579
-- Name: opportunity_premium_calculation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_premium_calculation_id_seq OWNED BY public.opportunity_premium_calculation.id;


--
-- TOC entry 580 (class 1259 OID 27662856)
-- Name: opportunity_premium_cover_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_premium_cover_detail (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    cover_map_id integer,
    policy_type_lid integer NOT NULL,
    cover_name character varying,
    cover_response character varying,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    created_by integer,
    updated_by integer
);


ALTER TABLE public.opportunity_premium_cover_detail OWNER TO nl2sql_ai;

--
-- TOC entry 581 (class 1259 OID 27662863)
-- Name: opportunity_premium_cover_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_premium_cover_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_premium_cover_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9158 (class 0 OID 0)
-- Dependencies: 581
-- Name: opportunity_premium_cover_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_premium_cover_detail_id_seq OWNED BY public.opportunity_premium_cover_detail.id;


--
-- TOC entry 582 (class 1259 OID 27662864)
-- Name: opportunity_previous_mediator_details; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_previous_mediator_details (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    company_id integer NOT NULL,
    location_id integer,
    branch_id integer,
    mediator_type character varying NOT NULL,
    CONSTRAINT chk_mediator_type CHECK (((mediator_type)::text = ANY (ARRAY[('TPA'::character varying)::text, ('BROKER'::character varying)::text, ('INSURER'::character varying)::text])))
);


ALTER TABLE public.opportunity_previous_mediator_details OWNER TO nl2sql_ai;

--
-- TOC entry 583 (class 1259 OID 27662870)
-- Name: opportunity_previous_mediator_details_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_previous_mediator_details_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_previous_mediator_details_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9159 (class 0 OID 0)
-- Dependencies: 583
-- Name: opportunity_previous_mediator_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_previous_mediator_details_id_seq OWNED BY public.opportunity_previous_mediator_details.id;


--
-- TOC entry 584 (class 1259 OID 27662871)
-- Name: opportunity_previous_placement_details; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_previous_placement_details (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    challenges_and_mitigation text,
    existing_competition text,
    remarks text
);


ALTER TABLE public.opportunity_previous_placement_details OWNER TO nl2sql_ai;

--
-- TOC entry 585 (class 1259 OID 27662876)
-- Name: opportunity_previous_placement_details_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_previous_placement_details_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_previous_placement_details_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9160 (class 0 OID 0)
-- Dependencies: 585
-- Name: opportunity_previous_placement_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_previous_placement_details_id_seq OWNED BY public.opportunity_previous_placement_details.id;


--
-- TOC entry 586 (class 1259 OID 27662877)
-- Name: opportunity_quote; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_quote (
    id integer NOT NULL,
    existing_quote_info character varying,
    remarks text,
    status_lid integer,
    opportunity_activity_id integer
);


ALTER TABLE public.opportunity_quote OWNER TO nl2sql_ai;

--
-- TOC entry 587 (class 1259 OID 27662882)
-- Name: opportunity_quote_comparison_report; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_quote_comparison_report (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    activity_id integer,
    opportunity_activity_id integer,
    status_lid integer,
    insurance_market text,
    client_specific text,
    issues_faced text,
    industry_benchmarking_comments text,
    analysis_recommendation text,
    overall_comments text,
    remarks text,
    created_by integer,
    updated_by integer,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.opportunity_quote_comparison_report OWNER TO nl2sql_ai;

--
-- TOC entry 588 (class 1259 OID 27662889)
-- Name: opportunity_quote_comparison_report_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_quote_comparison_report_document_map (
    id integer NOT NULL,
    quote_comparison_report_id integer NOT NULL,
    document_id integer NOT NULL,
    document_type_lid integer
);


ALTER TABLE public.opportunity_quote_comparison_report_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 589 (class 1259 OID 27662892)
-- Name: opportunity_quote_comparison_report_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_quote_comparison_report_document_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_quote_comparison_report_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9161 (class 0 OID 0)
-- Dependencies: 589
-- Name: opportunity_quote_comparison_report_document_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_quote_comparison_report_document_map_id_seq OWNED BY public.opportunity_quote_comparison_report_document_map.id;


--
-- TOC entry 590 (class 1259 OID 27662893)
-- Name: opportunity_quote_comparison_report_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_quote_comparison_report_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_quote_comparison_report_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9162 (class 0 OID 0)
-- Dependencies: 590
-- Name: opportunity_quote_comparison_report_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_quote_comparison_report_id_seq OWNED BY public.opportunity_quote_comparison_report.id;


--
-- TOC entry 591 (class 1259 OID 27662894)
-- Name: opportunity_quote_cover_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_quote_cover_detail (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    quote_id integer NOT NULL,
    cover_map_id integer NOT NULL,
    policy_type_id integer,
    cover_name text,
    insurer_cover_response text,
    created_at timestamp without time zone DEFAULT now(),
    updated_at timestamp without time zone DEFAULT now(),
    created_by integer,
    updated_by integer
);


ALTER TABLE public.opportunity_quote_cover_detail OWNER TO nl2sql_ai;

--
-- TOC entry 592 (class 1259 OID 27662901)
-- Name: opportunity_quote_cover_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_quote_cover_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_quote_cover_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9163 (class 0 OID 0)
-- Dependencies: 592
-- Name: opportunity_quote_cover_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_quote_cover_detail_id_seq OWNED BY public.opportunity_quote_cover_detail.id;


--
-- TOC entry 593 (class 1259 OID 27662902)
-- Name: opportunity_quote_doc_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_quote_doc_map (
    id integer NOT NULL,
    document_id integer,
    document_type_lid integer,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    created_by integer,
    updated_by integer,
    opportunity_activity_id integer
);


ALTER TABLE public.opportunity_quote_doc_map OWNER TO nl2sql_ai;

--
-- TOC entry 594 (class 1259 OID 27662907)
-- Name: opportunity_quote_doc_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_quote_doc_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_quote_doc_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9164 (class 0 OID 0)
-- Dependencies: 594
-- Name: opportunity_quote_doc_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_quote_doc_map_id_seq OWNED BY public.opportunity_quote_doc_map.id;


--
-- TOC entry 595 (class 1259 OID 27662908)
-- Name: opportunity_quote_entry; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_quote_entry (
    id integer NOT NULL,
    opportunity_id integer,
    broking_slip_id integer,
    insurer_id integer,
    quote_received_on date,
    basic_premium numeric,
    terrorism numeric,
    net_premium numeric,
    basic_brokerage_percentage numeric,
    insurer_remarks text,
    attachment_url text,
    status_id integer,
    created_by integer,
    updated_by integer,
    created_at timestamp without time zone DEFAULT now(),
    updated_at timestamp without time zone DEFAULT now(),
    opportunity_activity_id integer,
    deleted_at timestamp with time zone,
    insurer_location_id integer,
    basic_premium_percentage numeric(5,2),
    srcc_percentage numeric(5,2),
    srcc_amount numeric(19,2),
    terrorism_brokerage_percentage numeric(5,2),
    gst_percentage numeric(5,2),
    gst_amount numeric(19,2),
    total_gross_premium_inc_tax numeric(19,2),
    fee_percentage numeric(5,2),
    fee numeric(19,2),
    other_percentage numeric(5,2),
    other numeric(19,2),
    admin_charges_percentage numeric(5,2),
    admin_charges numeric(19,2),
    cess_percentage numeric(5,2),
    cess_amount numeric(19,2),
    gross_premium numeric(19,2),
    tc_brokerage_amount numeric(19,2),
    basic_brokerage_amount numeric(19,2),
    srcc_brokerage_amount numeric(19,2),
    brokerage_amount numeric(19,2),
    total_brokerage_amount numeric(19,2)
);


ALTER TABLE public.opportunity_quote_entry OWNER TO nl2sql_ai;

--
-- TOC entry 596 (class 1259 OID 27662915)
-- Name: opportunity_quote_entry_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_quote_entry_document_map (
    id integer NOT NULL,
    opportunity_quote_entry_id integer NOT NULL,
    document_id integer NOT NULL
);


ALTER TABLE public.opportunity_quote_entry_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 597 (class 1259 OID 27662918)
-- Name: opportunity_quote_entry_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_quote_entry_document_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_quote_entry_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9165 (class 0 OID 0)
-- Dependencies: 597
-- Name: opportunity_quote_entry_document_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_quote_entry_document_map_id_seq OWNED BY public.opportunity_quote_entry_document_map.id;


--
-- TOC entry 598 (class 1259 OID 27662919)
-- Name: opportunity_quote_entry_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_quote_entry_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_quote_entry_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9166 (class 0 OID 0)
-- Dependencies: 598
-- Name: opportunity_quote_entry_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_quote_entry_id_seq OWNED BY public.opportunity_quote_entry.id;


--
-- TOC entry 599 (class 1259 OID 27662920)
-- Name: opportunity_quote_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_quote_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_quote_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9167 (class 0 OID 0)
-- Dependencies: 599
-- Name: opportunity_quote_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_quote_id_seq OWNED BY public.opportunity_quote.id;


--
-- TOC entry 600 (class 1259 OID 27662921)
-- Name: opportunity_quote_tax_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_quote_tax_map (
    id integer NOT NULL,
    opportunity_quote_entry_id integer,
    tax_lid integer,
    tax_value numeric,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    created_by integer,
    updated_by integer
);


ALTER TABLE public.opportunity_quote_tax_map OWNER TO nl2sql_ai;

--
-- TOC entry 601 (class 1259 OID 27662928)
-- Name: opportunity_quote_tax_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_quote_tax_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_quote_tax_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9168 (class 0 OID 0)
-- Dependencies: 601
-- Name: opportunity_quote_tax_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_quote_tax_map_id_seq OWNED BY public.opportunity_quote_tax_map.id;


--
-- TOC entry 602 (class 1259 OID 27662929)
-- Name: opportunity_rfp_activity_document_map; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_rfp_activity_document_map (
    id integer NOT NULL,
    opportunity_activity_map_id integer NOT NULL,
    rfp_detail_id integer NOT NULL,
    document_id integer NOT NULL,
    document_type_lid integer
);


ALTER TABLE public.opportunity_rfp_activity_document_map OWNER TO nl2sql_ai;

--
-- TOC entry 603 (class 1259 OID 27662932)
-- Name: opportunity_rfp_activity_document_map_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_rfp_activity_document_map_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_rfp_activity_document_map_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9169 (class 0 OID 0)
-- Dependencies: 603
-- Name: opportunity_rfp_activity_document_map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_rfp_activity_document_map_id_seq OWNED BY public.opportunity_rfp_activity_document_map.id;


--
-- TOC entry 604 (class 1259 OID 27662933)
-- Name: opportunity_rfp_client_contact_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_rfp_client_contact_detail (
    id integer NOT NULL,
    opportunity_rfp_details_entry_id integer NOT NULL,
    contact_id integer,
    expected_premium numeric(19,2),
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL
);


ALTER TABLE public.opportunity_rfp_client_contact_detail OWNER TO nl2sql_ai;

--
-- TOC entry 605 (class 1259 OID 27662938)
-- Name: opportunity_rfp_client_contact_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_rfp_client_contact_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_rfp_client_contact_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9170 (class 0 OID 0)
-- Dependencies: 605
-- Name: opportunity_rfp_client_contact_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_rfp_client_contact_detail_id_seq OWNED BY public.opportunity_rfp_client_contact_detail.id;


--
-- TOC entry 606 (class 1259 OID 27662939)
-- Name: opportunity_rfp_client_contact_influencers; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_rfp_client_contact_influencers (
    id integer NOT NULL,
    client_contact_id integer NOT NULL,
    influencer_contact_id integer NOT NULL
);


ALTER TABLE public.opportunity_rfp_client_contact_influencers OWNER TO nl2sql_ai;

--
-- TOC entry 607 (class 1259 OID 27662942)
-- Name: opportunity_rfp_client_contact_influencers_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_rfp_client_contact_influencers_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_rfp_client_contact_influencers_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9171 (class 0 OID 0)
-- Dependencies: 607
-- Name: opportunity_rfp_client_contact_influencers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_rfp_client_contact_influencers_id_seq OWNED BY public.opportunity_rfp_client_contact_influencers.id;


--
-- TOC entry 608 (class 1259 OID 27662943)
-- Name: opportunity_rfp_cover_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_rfp_cover_detail (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    cover_map_id integer NOT NULL,
    policy_type_id integer NOT NULL,
    cover_name character varying NOT NULL,
    cover_response character varying(25000) NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    created_by integer,
    updated_by integer
);


ALTER TABLE public.opportunity_rfp_cover_detail OWNER TO nl2sql_ai;

--
-- TOC entry 609 (class 1259 OID 27662950)
-- Name: opportunity_rfp_cover_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_rfp_cover_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_rfp_cover_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9172 (class 0 OID 0)
-- Dependencies: 609
-- Name: opportunity_rfp_cover_detail_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_rfp_cover_detail_id_seq OWNED BY public.opportunity_rfp_cover_detail.id;


--
-- TOC entry 610 (class 1259 OID 27662951)
-- Name: opportunity_rfp_credit_sharing; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_rfp_credit_sharing (
    id integer NOT NULL,
    executive_id integer,
    credit_sharing_percentage numeric(5,2),
    opportunity_rfp_details_entry_id integer NOT NULL,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    deleted_at timestamp with time zone,
    created_by integer NOT NULL,
    updated_by integer NOT NULL
);


ALTER TABLE public.opportunity_rfp_credit_sharing OWNER TO nl2sql_ai;

--
-- TOC entry 611 (class 1259 OID 27662956)
-- Name: opportunity_rfp_credit_sharing_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_rfp_credit_sharing_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_rfp_credit_sharing_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9173 (class 0 OID 0)
-- Dependencies: 611
-- Name: opportunity_rfp_credit_sharing_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nl2sql_ai
--

ALTER SEQUENCE public.opportunity_rfp_credit_sharing_id_seq OWNED BY public.opportunity_rfp_credit_sharing.id;


--
-- TOC entry 612 (class 1259 OID 27662957)
-- Name: opportunity_rfp_detail; Type: TABLE; Schema: public; Owner: nl2sql_ai
--

CREATE TABLE public.opportunity_rfp_detail (
    id integer NOT NULL,
    opportunity_id integer NOT NULL,
    opportunity_activity_id integer NOT NULL,
    remarks text,
    status_lid integer NOT NULL,
    created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    created_by integer,
    updated_by integer
);


ALTER TABLE public.opportunity_rfp_detail OWNER TO nl2sql_ai;

--
-- TOC entry 613 (class 1259 OID 27662964)
-- Name: opportunity_rfp_detail_id_seq; Type: SEQUENCE; Schema: public; Owner: nl2sql_ai
--

CREATE SEQUENCE public.opportunity_rfp_detail_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.opportunity_rfp_detail_id_seq OWNER TO nl2sql_ai;

--
-- TOC entry 9174 (class 0 OID 0)
-- Dependencies: 613
