CREATE TABLE IF NOT EXISTS satellite_initial_conditions (
    satellite_initial_condition_id BIGSERIAL PRIMARY KEY,
    satellite_id BIGINT NOT NULL,
    movement_model VARCHAR(32) NOT NULL DEFAULT 'FOTO',
    orb_time TIMESTAMP NOT NULL,
    orb_revolution BIGINT NOT NULL,
    x DOUBLE PRECISION NOT NULL,
    y DOUBLE PRECISION NOT NULL,
    z DOUBLE PRECISION NOT NULL,
    vx DOUBLE PRECISION NOT NULL,
    vy DOUBLE PRECISION NOT NULL,
    vz DOUBLE PRECISION NOT NULL,
    s_ball DOUBLE PRECISION NOT NULL,
    f81 DOUBLE PRECISION NOT NULL,
    received_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    calculated_at TIMESTAMP,
    last_calculated BOOLEAN NOT NULL DEFAULT FALSE
);

CREATE INDEX idx_satellite_initial_conditions_satellite_id ON satellite_initial_conditions(satellite_id);
CREATE INDEX idx_satellite_initial_conditions_last_calculated ON satellite_initial_conditions(satellite_id, last_calculated);
